public void Index_Get_ReturnsHomePageViewModel() { // Arrange const int homePageId = 1; var controller = new HomePageController { ApplicationService = ApplicationServiceMock.Object, MapModelService = new MapModelService() }; var homePage = new HomePage { Id = homePageId }; ApplicationServiceMock.Setup(x => x.GetPageModel <HomePage>(DocTypeAliases.HomePage.Alias)).Returns(homePage); var homePageViewModel = controller.MapModelService.Map <HomePageViewModel>(homePage); // Act var result = controller.Index() as ViewResult; // Assert Assert.IsNotNull(result); Assert.IsAssignableFrom <HomePageViewModel>(result.Model); Assert.AreEqual(homePageViewModel.Id, ((HomePageViewModel)result.Model).Id); }
public void ShouldShowIndexView() { ViewResult result = controller.Index(); Assert.That(result.ViewName, Is.EqualTo("Index")); }