Example #1
0
        public void FormParser_PostFormAnswerBuilder_Ids()
        {
            JObject obj = FormParser.PostFormAnswerBuilder(_formAnswer);

            var formBody = obj["formAnswer"];

            var formId  = formBody["formId"].ToString();
            var coordId = formBody["coordinatorId"].ToString();

            Assert.AreEqual(_formAnswer.FormId, formId);
            Assert.AreEqual(_formAnswer.CoordinatorId, coordId);
        }
Example #2
0
        public void FormParser_PostFormAnswerBuilder_MultipleChoiceAnswers()
        {
            JObject obj = FormParser.PostFormAnswerBuilder(_formAnswer);

            var formBody = obj["formAnswer"];
            var multipleChoiceAnswersList = formBody["multipleChoiceAnswers"].ToObject <List <JObject> >();

            var questionTitle   = multipleChoiceAnswersList[0]["question"].ToString();
            var optionsAnswered = multipleChoiceAnswersList[0]["answers"].ToObject <List <string> >();

            Assert.AreEqual(_formAnswer.MultipleChoiceAnswers[0].Question, questionTitle);
            Assert.AreEqual(_formAnswer.MultipleChoiceAnswers[0].Answers, optionsAnswered);
        }
Example #3
0
        public void FormParser_PostFormAnswerBuilder_DiscursiveAnswers()
        {
            JObject obj = FormParser.PostFormAnswerBuilder(_formAnswer);

            var formBody = obj["formAnswer"];
            var discursiveAnswersList = formBody["discursiveAnswers"].ToObject <List <JObject> >();

            var discursiveQuestion = discursiveAnswersList[0]["question"].ToString();
            var discursiveAnswer   = discursiveAnswersList[0]["answer"].ToString();

            Assert.AreEqual(_formAnswer.DiscursiveAnswers[0].Question, discursiveQuestion);
            Assert.AreEqual(_formAnswer.DiscursiveAnswers[0].Answer, discursiveAnswer);
        }