public void Test_When_Customer_Controller_Index_Action_Called_That_First_Ten_Customers_Returned() { // Arrange var customerController = new CustomerController(getCustomersByPage.Object); // Act ViewResult result = customerController.Index(1, 10) as ViewResult; // Assert Assert.AreEqual(((CustomerViewModel)result.Model).CustomerGridResult.Entity.Count(), 10, "10 customers were not returned"); }
public void Test_When_Customer_Controller_Index_Action_Called_That_Customer_View_Returned() { // Arrange const string expectedViewName = "CustomerList"; var customerController = new CustomerController(getCustomersByPage.Object); // Setup controller with service injection // Act var result = customerController.Index(1, 10) as ViewResult; // Assert Assert.IsNotNull(result, "Should have returned a ViewResult"); Assert.AreEqual(expectedViewName, result.ViewName, "View name should have been {0}", expectedViewName); }