public virtual void SetUp() { autoMocker = new RhinoAutoMocker<GameDefinitionController>(); autoMocker.Get<IGameDefinitionRetriever>() .Expect(mock => mock.GetTrendingGames(GameDefinitionController.NUMBER_OF_TRENDING_GAMES_TO_SHOW, GameDefinitionController.NUMBER_OF_DAYS_OF_TRENDING_GAMES)) .Return(trendingGames); AutomapperConfiguration.Configure(); urlHelperMock = MockRepository.GenerateMock<UrlHelper>(); autoMocker.ClassUnderTest.Url = urlHelperMock; asyncRequestMock = MockRepository.GenerateMock<HttpRequestBase>(); asyncRequestMock.Expect(x => x.Headers) .Repeat.Any() .Return(new System.Net.WebHeaderCollection { { "X-Requested-With", "XMLHttpRequest" } }); var context = MockRepository.GenerateMock<HttpContextBase>(); context.Expect(x => x.Request) .Repeat.Any() .Return(asyncRequestMock); autoMocker.ClassUnderTest.ControllerContext = new ControllerContext(context, new RouteData(), autoMocker.ClassUnderTest); currentUser = new ApplicationUser() { Id = "user id", CurrentGamingGroupId = 15151 }; }