Why is Controller.Url null when I unit test my action?
问题 I've followed this answer to mock HttpContext, Request, Response and User and set Controller.ControllerContext and Controller.Url . Controller.Url is most definitely not null before calling controller.Index() . However, inside controller.Index() , it is null. It seems very strange. What am I missing? Here's my test fixture: [TestFixture] public class ControllerFixtureBase { private Mock<HttpContextBase> _httpContextMock; private RouteCollection _routes; [SetUp] public void SetUp() { var