public void HomeController() { //PArk controller test var controller = new ParkController(parkDAL, weatherDAL); //Index Action should return index view var result = controller.Index() as ViewResult; Assert.AreEqual("Index", result.ViewName); }
public void HomeController_IndexAction_ReturnIndexView() { //Arrange ParkController controller = new ParkController(); //Act ViewResult result = controller.Index() as ViewResult; //Assert Assert.AreEqual("Index", result.ViewName); }
public void ParkController_IndexAction_ReturnIndexView() { //Arrange Mock <IWeatherDAO> mockIWeatherDAO = new Mock <IWeatherDAO>(); Mock <IParkDAO> mockIParkDAO = new Mock <IParkDAO>(); ParkController controller = new ParkController(mockIParkDAO.Object, mockIWeatherDAO.Object); //Act // Cast ActionResult to ViewResult ViewResult result = controller.Index() as ViewResult; //Assert Assert.AreEqual("Index", result.ViewName); mockIParkDAO.Verify(m => m.GetAllParks()); //verify that our test called GetAllParks on the Mock IParkDAL }