public void Index() { // Arrange HomeController controller = new HomeController(); // Act ViewResult result = controller.Index() as ViewResult; // Assert Assert.AreEqual("Modify this template to jump-start your ASP.NET MVC application.", result.ViewBag.Message); }
public void Index() { // Arrange var db = new FakeOdeToFoodDb(); db.AddSet(TestData.Restaurants); HomeController controller = new HomeController(db); controller.ControllerContext = new FakeControllerContext(); // Act ViewResult result = controller.Index() as ViewResult; IEnumerable<RestaurantListViewModel> model = result.Model as IEnumerable<RestaurantListViewModel>; // Assert Assert.AreEqual(10, model.Count()); }