public ActionResult Survey(Survey survey) { if (!ModelState.IsValid) { survey.DropDownList = surveyDal.GetParkList(); return(View("Survey", survey)); } surveyDal.SubmitSurvey(survey); return(RedirectToAction("SurveyResults")); }
public void SubmitSurvey() { SurveySqlDAL surveySqlDAL = new SurveySqlDAL(connectionString); Survey survey = new Survey { ParkCode = "AAA", EmailAddress = "*****@*****.**", State = "Ohio", ActivityLevel = "inactive" }; Assert.IsTrue(surveySqlDAL.SubmitSurvey(survey)); }
public ActionResult SurveySubmit(SurveyForm surveyForm) { if (!ModelState.IsValid) { return(View("SurveySubmit", surveyForm)); } SurveySqlDAL surveyDAL = new SurveySqlDAL(connectionString); surveyDAL.SubmitSurvey(surveyForm); TempData["StatusMessage"] = "Your Survey Has Been Saved"; return(RedirectToAction("Index")); }
public void SubmitSurveyTest() { //Arrange SurveySqlDAL surveySqlDAL = new SurveySqlDAL(connectionString); SurveyForm model = new SurveyForm() { ParkCode = "gnp", EmailAddress = "*****@*****.**", State = "test", ActivityLevel = "test" }; //Act bool didWork = surveySqlDAL.SubmitSurvey(model); //Assert Assert.AreEqual(true, didWork); }
public void SubmitSurveyTest() { //Arrange SurveySqlDAL surveyDal = new SurveySqlDAL(connectionString); Survey survey = new Survey { Email = "*****@*****.**", ParkCode = "TST2", State = "Ohio", ActivityLevel = "active" }; //Act bool didWork = surveyDal.SubmitSurvey(survey); //Assert Assert.AreEqual(true, didWork); }
public void HomeController_SurveySubmitAction_RedirectToIndexView() { //Arrange SurveySqlDAL mockDal = new SurveySqlDAL(connectionString); SurveyController controller = new SurveyController(); SurveyForm model = new SurveyForm() { ParkCode = "gnp", EmailAddress = "*****@*****.**", State = "test", ActivityLevel = "test" }; //Act mockDal.SubmitSurvey(model); RedirectToRouteResult result = controller.SurveySubmit(model) as RedirectToRouteResult; //Assert Assert.IsNotNull(result); Assert.AreEqual("Index", result.RouteValues["action"]); }