I suggest making fun of the IsAuthenticated property. There are several more posts about this, you can search for them.
Here is an example of query bullying using Moq:
var mockRequest = new Mock<HttpRequestBase>();
mockRequest.Setup(x => x.IsAuthenticated).Returns(true);
var mockContext = new Mock<ControllerContext>();
mockContext.Setup(x => x.Request).Returns(mockRequest.Object);
var myController = new MyController();
myController.ControllerContext = new ControllerContext(mockContext.Object, new RouteData(), myController);
I would really like to take a look at the ubiquitous Scott Hanselman code "MvcMockHelpers" that I use:
http://www.hanselman.com/blog/ASPNETMVCSessionAtMix08TDDAndMvcMockHelpers.aspx
source
share