public Index ( string q, int page ) : System.Web.Mvc.ActionResult | ||
q | string | |
page | int | |
Résultat | System.Web.Mvc.ActionResult |
public void IndexAction_With_Search_Term_Should_Filter() { // Arrange string searchterm = "Dinner we will be searching for (spaghetti)"; var testData = FakeDinnerData.CreateTestDinners(); var dinner = FakeDinnerData.CreateDinner(); dinner.Title = searchterm; testData.Add(dinner); var repository = new FakeDinnerRepository(testData); var nerdIdentity = FakeIdentity.CreateIdentity("SomeUser"); var controller = new DinnersController(repository, nerdIdentity); // Act // Get first page ViewResult result = (ViewResult)controller.Index("etti", null); PagedList<Dinner> list = result.ViewData.Model as PagedList<Dinner>; // Assert Assert.AreEqual(searchterm, list.First().Title); }
public void IndexAction_With_Dinner_Just_Started_Should_Show_Dinner() { // Arrange var testData = FakeDinnerData.CreateTestDinners(); var dinner = FakeDinnerData.CreateDinner(); dinner.EventDate = DateTime.Now.AddHours(1); dinner.Title = "Dinner which just started"; testData.Add(dinner); var repository = new FakeDinnerRepository(testData); var nerdIdentity = FakeIdentity.CreateIdentity("SomeUser"); var controller = new DinnersController(repository, nerdIdentity); // Act // Get first page ViewResult result = (ViewResult)controller.Index(null, null); PagedList<Dinner> list = result.ViewData.Model as PagedList<Dinner>; // Assert Assert.AreEqual("Dinner which just started", list.First().Title); }