public void IndexShoudWorkCorrectlyOnlyWithCurrentFilterParameter() { var homeService = new Mock<IHomeService>(); var usersService = new Mock<IUsersService>(); var cacheService = new Mock<ICacheService>(); homeService.Setup(x => x.GetAll()) .Returns(new List<Home>().AsQueryable()); var controller = new HomeController(usersService.Object, homeService.Object, cacheService.Object); controller.WithCallTo(x => x.Index(null, "someFilter", null)) .ShouldRenderView("Index"); }
public void SearchShoudReturnNoPagesFoundContentIfThereAreNoHomes() { var homeService = new Mock<IHomeService>(); var usersService = new Mock<IUsersService>(); var cacheService = new Mock<ICacheService>(); homeService.Setup(x => x.GetAll()) .Returns(new List<Home>().AsQueryable()); var controller = new HomeController(usersService.Object, homeService.Object, cacheService.Object); controller.WithCallTo(x => x.Search("someSearchInput")) .ShouldReturnContent("No pages found!"); }
public void IndexShoudRenderViewWithCorrectModelAndNoModelErrors() { var homeService = new Mock<IHomeService>(); var usersService = new Mock<IUsersService>(); var cacheService = new Mock<ICacheService>(); homeService.Setup(x => x.GetAll()) .Returns(new List<Home>().AsQueryable()); var controller = new HomeController(usersService.Object, homeService.Object, cacheService.Object); controller.WithCallTo(x => x.Index("someInputSearch", "someFilter", 5)) .ShouldRenderView("Index") .WithModel<IPagedList<DetailsInstitutionViewModel>>() .AndNoModelErrors(); }