public void Then_singlelineTextBox_Should_Display_on_Screen() { //SetUp Epi.Web.MVC.Facade.ISurveyFacade iSurveyFacade; Epi.Web.Common.Message.SurveyInfoRequest surveyInfoRequest; //Arrange surveyInfoRequest = new Epi.Web.Common.Message.SurveyInfoRequest(); List <string> SurveyIdList = new List <string>(); SurveyIdList.Add("1"); surveyInfoRequest.Criteria.SurveyIdList = SurveyIdList; iSurveyFacade = new TestSurveyFacade(surveyInfoRequest); var surveyId = "7696d742-e42d-45d1-8352-ec8c3f0db3c2"; int CurrentPage = 1; //Act var form = iSurveyFacade.GetSurveyFormData(surveyId, CurrentPage, null); //Assert Assert.NotNull(form); Assert.Greater(form.Fields.Count, 0); }
public void Then_Show_Finalized_Page() { //Setup Epi.Web.MVC.Facade.ISurveyFacade iSurveyFacade; Epi.Web.Common.Message.SurveyInfoRequest surveyInfoRequest; //Arrange SurveyInfoModel surveyInfoModel = new TestSurveyFacade().GetSurveyInfoModel(""); surveyInfoRequest = new Epi.Web.Common.Message.SurveyInfoRequest(); surveyInfoRequest.Criteria.SurveyIdList = "1"; iSurveyFacade = new TestSurveyFacade(surveyInfoRequest); var controller = new Epi.Web.MVC.Controllers.FinalController(iSurveyFacade); ViewResult c = controller.Index("1", "final") as ViewResult; //Assert Assert.AreEqual("PostSubmit", c.ViewName); /*Is it returning the right view name?*/ Assert.AreEqual("Epi.Web.MVC.Models.SurveyInfoModel", c.Model.ToString()); /*Is it returning the right view to the final view?*/ }
public void Then_See_First_Data_Entry_Page() { //SetUp Epi.Web.MVC.Facade.ISurveyFacade iSurveyFacade; Epi.Web.Common.Message.SurveyInfoRequest surveyInfoRequest; //Arrange surveyInfoRequest = new Epi.Web.Common.Message.SurveyInfoRequest(); surveyInfoRequest.Criteria.SurveyIdList = "1"; iSurveyFacade = new TestSurveyFacade(surveyInfoRequest); var controller = new Epi.Web.MVC.Controllers.HomeController(iSurveyFacade); ViewResult c = controller.Index("1") as ViewResult; //MvcDynamicForms.Form F = c.Model as MvcDynamicForms.Form; //Assert Assert.AreEqual("Index", c.ViewName); /*Is it returning the right view name?*/ //Assert.AreEqual("MvcDynamicField_", F.FieldPrefix); /*Is it rendering form prefix*/ }
public void Then_Submit_Survey() { //SetUp Epi.Web.MVC.Facade.ISurveyFacade iSurveyFacade; Epi.Web.Common.Message.SurveyInfoRequest surveyInfoRequest; //Arrange SurveyInfoModel surveyInfoModel = new TestSurveyFacade().GetSurveyInfoModel(""); surveyInfoRequest = new Epi.Web.Common.Message.SurveyInfoRequest(); surveyInfoRequest.Criteria.SurveyIdList = "1"; iSurveyFacade = new TestSurveyFacade(surveyInfoRequest); var controller = new Epi.Web.MVC.Controllers.SurveyController(iSurveyFacade); ViewResult c = controller.Index(surveyInfoModel, "Submit") as ViewResult; //Assert /* * It goes to the, surveyController's Index method of type post. As simulating form with posted value * requires more work, at this point we can safely assume that the survey submits the data. */ }
public void Then_Open_The_Survey() { //SetUp Epi.Web.MVC.Facade.ISurveyFacade iSurveyFacade; Epi.Web.Common.Message.SurveyInfoRequest surveyInfoRequest; //Arrange surveyInfoRequest = new Epi.Web.Common.Message.SurveyInfoRequest(); surveyInfoRequest.Criteria.SurveyIdList = "1"; iSurveyFacade = new TestSurveyFacade(surveyInfoRequest); var controller = new Epi.Web.MVC.Controllers.SurveyController(iSurveyFacade); ViewResult c = controller.Notify("1", "page") as ViewResult; //MvcDynamicForms.Form f = c.Model as MvcDynamicForms.Form; MvcDynamicForms.Form f = iSurveyFacade.GetSurveyFormData("1", 1, null); //Assert.AreEqual(typeof(MvcDynamicForms.Form), c.Model);//test to make sure it is returning field prefix //Does it render all the controls? //Assert Assert.AreEqual(7, f.Fields.Count); //test to make sure it is returning correct number of items // Does it render the text box? Assert.AreEqual("MvcDynamicForms.Fields.TextBox", f.Fields[0].GetType().ToString()); //end item in the forms collection is a textbox }