public void TestDetail() { // Arrange ParkMockDAO parkDAO = new ParkMockDAO(); WeatherMockDAO weatherDAO = new WeatherMockDAO(); HomeController controller = new HomeController(parkDAO, weatherDAO); // Act IActionResult resultFahrenheit = controller.Detail("CVNP", "F"); IActionResult resultCelcius = controller.Detail("CVNP", "C"); // Assert ViewResult vr1 = resultFahrenheit as ViewResult; Weather vr1Result = vr1.Model as Weather; Assert.IsNotNull(vr1, "Search did not reuturn a Detail View"); Assert.AreEqual(65, vr1Result.High); Assert.AreEqual(34, vr1Result.High); ViewResult vr2 = resultCelcius as ViewResult; Weather vr2Result = vr1.Model as Weather; Assert.IsNotNull(vr2, "Search did not reuturn a Detail View"); Assert.AreEqual(18, vr1Result.High); Assert.AreEqual(1, vr1Result.High); }
public void TestGetAllParks() { //Arrange ParkMockDAO parkDAO = new ParkMockDAO(); WeatherMockDAO weatherDAO = new WeatherMockDAO(); ParkController controller = new ParkController(weatherDAO, parkDAO); //Act IList <Park> parks = parkDAO.GetAllParks(); //Assert Assert.AreEqual(parks.Count, 5, "Testing the number of Parks returned"); }
public void TestIndex() { // Arrange ParkMockDAO parkDAO = new ParkMockDAO(); WeatherMockDAO weatherDAO = new WeatherMockDAO(); HomeController controller = new HomeController(parkDAO, weatherDAO); // Act IActionResult result = controller.Index(); // Assert ViewResult vr = result as ViewResult; Assert.IsNotNull(vr, "Index did not return a ViewResult"); }
public void TestGetParkDetail() { //Arrange ParkMockDAO parkDAO = new ParkMockDAO(); WeatherMockDAO weatherDAO = new WeatherMockDAO(); ParkController controller = new ParkController(weatherDAO, parkDAO); //Act Park park = parkDAO.GetParkDetail("CVNP"); IActionResult result = controller.ParkDetail("CVNP"); //Assert ViewResult vr = result as ViewResult; Assert.IsNotNull(vr); Assert.AreEqual("CVNP", park.ParkCode); Assert.AreEqual("Ohio", park.State); Assert.AreEqual("Woodland", park.Climate); }