public void SurveyResult_PingReturnsSurveyResultView() { Mock <ISurveySqlDAL> mockSurvey = new Mock <ISurveySqlDAL>(); mockSurvey.Setup(m => m.GetFavoriteParkResults()); SurveyController controller = new SurveyController(mockSurvey.Object); var result = controller.SurveyResult(); Assert.IsTrue(result is ViewResult); var viewResult = result as ViewResult; Assert.AreEqual("SurveyResult", viewResult.ViewName); }
public void SurveyAction_ReturnsCorrectView() { //Arrange SurveyBodyDouble fakeDal = new SurveyBodyDouble(); SurveyController controller = new SurveyController(fakeDal); Survey fakeSurvey = new Survey(); //Act ActionResult result = controller.SurveyResult(fakeSurvey); //Assert //Test to see if result is of type ViewResult Assert.IsTrue(result.GetType() == typeof(ViewResult)); //Cast result into a ViewResult ViewResult vr = (ViewResult)result; Assert.AreEqual("SurveyResult", vr.ViewName); //<-- check the name of the view }