예제 #1
0
        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_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
        }