Mocking HttpContextBase with Moq
I have a unit test fixture in which I'm trying to test a ControllerAction on an ASP.NET MVC controller that's used for membership functions on a web app. I'm trying to mock the HttpContext for the tests. The ControllerAction under test actually sets properties on the HttpContext, such as Session values, Response.Cookies values, etc. This isn't all of the code, but here is a rough sample of the test that I'm trying to get to run: [Test] public void ValidRegistrationDataSuccessfullyCreatesAndRegistersUser() { var context = new Mock<HttpContextBase>() {DefaultValue = DefaultValue.Mock}; context