public void GivenIAnsweredTheQuestionWithTheAnswersAs(string questionText, string answers, string myAnswer)
        {
            SurveySays.Domain.Api.Survey survey = ScenarioContext.Current["Survey"] as SurveySays.Domain.Api.Survey;

            SingleChoiceQuestion question = new SingleChoiceQuestion(questionText);
            PopulateAnswers(question, answers);
            survey.AddQuestion(question);
            Choice choice = question.Choices.SingleOrDefault(c => c.DisplayText.Equals(myAnswer));
            survey.RecordSingleAnswer(question.Id, choice.Id);
        }
Exemple #2
0
        public void wrong_question_type_should_throw_exception()
        {
            // Arrange.
            var generator = new TextAnswerQuestionStatisticsGenerator();
            var q         = new SingleChoiceQuestion(1, "Lorem ipsum", 1, new List <string> {
                "a", "b", "c"
            });
            var answers = new List <Answer>();

            // Act.
            var e = Assert.Throws <ArgumentException>(() => generator.Generate(q, answers));
        }
Exemple #3
0
        public void ToString_WillReturnTheCorrectFormat()
        {
            var singleChoiceQuestion = new SingleChoiceQuestion();

            singleChoiceQuestion.Items.Add(new PossibleAnswer {
                Name = "option"
            });

            var s = singleChoiceQuestion.ToString();

            Assert.AreEqual("   |option|", s);
        }
        public override IChoiceQuestion CreateChoiceQuestion(string input)
        {
            SingleChoiceQuestion singleChoiceQuestion = new SingleChoiceQuestion();

            string[] splitInput = input.Split();
            for (int i = 1; i <= Convert.ToInt16(splitInput[2]); i++)
            {
                singleChoiceQuestion.PossibleAnswers.Add(splitInput[i + 2]);
            }

            return(singleChoiceQuestion);
        }
        public SingleChoiceQuestionViewModel(SingleChoiceQuestion question)
        {
            #region Precondition
            if (question == null)
                throw new ArgumentNullException("question");

            if (question.Choices == null || question.Choices.Count < 2)
                throw new ArgumentException("Для выбора необходимо не менее двух вариантов.");
            #endregion

            Title = question.Title;
            Description = question.Description;
            CanSkip = question.CanSkip;
            ChoiceViewModels = question.Choices.Select(t => new ChoiceViewModel(t)).ToList();
        }
Exemple #6
0
        public Base Create(StringReader input)
        {
            Base question = null;

            string[] line = input.ReadLine().Split();
            if (line[0] == "FT")
            {
                question = new FreeTextQuestion();
            }
            if (line[0] == "SC")
            {
                question = new SingleChoiceQuestion();
            }

            return(question);
        }
        public void GivenTheFirstQuestionIsWithTheFollowingAnswers(string questionKey, string questionText, Table answers)
        {
            SurveySays.Domain.Api.Survey survey = ScenarioContext.Current["Survey"] as SurveySays.Domain.Api.Survey;

            SingleChoiceQuestion question = new SingleChoiceQuestion(questionText);
            foreach (var item in answers.Rows)
            {
                Choice choice = new Choice();

                choice.DisplayText = item[0];
                choice.Value = item["Answer"];
                choice.Id = Guid.NewGuid();
                question.AddChoice(choice);
            }
            survey.AddQuestion(question);
            ScenarioContext.Current["question-" + questionKey] = question;
        }
        public IQuestion CreateQuestion(string input)
        {
            IQuestion question = null;

            string[] splitInput = input.Split();

            if (splitInput[1] == "FT")
            {
                question = new FreeTextQuestion();
            }
            if (splitInput[1] == "SC")
            {
                question = new SingleChoiceQuestion();
            }

            question.Text = splitInput[2];
            return(question);
        }
Exemple #9
0
        public void ToString_WillReturnTheCorrectFormat()
        {
            var singleChoiceQuestion = new SingleChoiceQuestion
            {
                Name  = "Text",
                Items = new ItemsCollection {
                    new PossibleAnswer {
                        Name = "A1"
                    }, new PossibleAnswer {
                        Name = "A2"
                    }
                }
            };

            string s = singleChoiceQuestion.ToString();

            Assert.AreEqual("   |A1|A2|", s);
        }
        public Base Create(StringReader input)
        {
            Question question = null;

            string line = input.ReadLine();

            string[] lineSplit = line.Split();

            switch (lineSplit[0])
            {
            case "FT": question = new FreeTextQuestion();
                break;

            case "SC": question = SingleChoiceQuestion.Create(line);
                break;
            }

            return(question);
        }
 public SingleChoiceQuestionStatsGenerator()
 {
     // Arrange.
     statsGenerator = new SingleChoiceQuestionStatisticsGenerator();
     question       = new SingleChoiceQuestion(1, "test question", 1, new string[] { "opcja 1", "opcja 2", "opcja 3" });
     answers        = new List <Answer>
     {
         new SingleChoiceAnswer {
             Id = 1, Choice = "opcja 1", QuestionId = question.Id
         },
         new SingleChoiceAnswer {
             Id = 2, Choice = "opcja 2", QuestionId = question.Id
         },
         new SingleChoiceAnswer {
             Id = 3, Choice = "opcja 3", QuestionId = question.Id
         },
         new SingleChoiceAnswer {
             Id = 4, Choice = "opcja 1", QuestionId = question.Id
         },
     };
 }
        public Base Create(StringReader input)
        {
            Question question = null;
            var      readLine = input.ReadLine();
            var      strings  = readLine.Split();

            if (strings[0] == "FT")
            {
                question = new FreeTextQuestion();
            }
            if (strings[0] == "SC")
            {
                question = SingleChoiceQuestion.Create(readLine);
            }
            if (strings[0] == "MC")
            {
                question = MultipleChoiceQuestion.Create(readLine);
            }

            return(question);
        }
Exemple #13
0
            private static void ParseQuestion(Queue <Token> tokens, Test test, TestData testData)
            {
                Question question;
                int      i = 1, checkedCount = 0, Row = 0;
                bool     textParsed = false, scoreParsed = false, optionParsed = false, codeParsed = false;

                Row = tokens.Peek().Row;
                Consume(tokens, "question");
                Consume(tokens, "{");
                var type = ParseType(tokens);

                switch (type)
                {
                case (int)Question.QuestionTypeEnum.SingleChoiceQuestion:
                    question = new SingleChoiceQuestion();
                    break;

                case (int)Question.QuestionTypeEnum.MultiChoiceQuestion:
                    question = new MultiChoiceQuestion();
                    break;

                case (int)Question.QuestionTypeEnum.TextQuestion:
                    question = new TextQuestion();
                    break;

                case (int)Question.QuestionTypeEnum.DragAndDropQuestion:
                    question = new DragAndDropQuestion();
                    break;

                case (int)Question.QuestionTypeEnum.CodeQuestion:
                    question = new CodeQuestion();
                    break;

                default:
                    question = new SingleChoiceQuestion();
                    break;
                }

                question.Test = test;
                while (tokens.Peek().Value != "}")
                {
                    switch (tokens.Peek().Value)
                    {
                    case "text":
                        if (!textParsed)
                        {
                            question.Title = ParseString(tokens, "text");
                        }
                        else
                        {
                            throw new Exception(string.Format("Text already parsed (Quesiton (Row - {0})).", Row));
                        }
                        textParsed = true;
                        break;

                    case "score":
                        if (!scoreParsed)
                        {
                            question.Score = ParseInt(tokens, "score");
                        }
                        else
                        {
                            throw new Exception(string.Format("Score already parsed (Quesiton (Row - {0})).", Row));
                        }
                        scoreParsed = true;
                        break;

                    case "option":
                        if (question is TextQuestion)
                        {
                            if (i == 1)
                            {
                                ParseOption(tokens, question, testData, i++, ref checkedCount);
                            }
                            else
                            {
                                throw new Exception(string.Format(
                                                        "TextQuestion поддерживает только один ответ (Quesiton (Row - {0})).", Row));
                            }
                        }
                        else
                        {
                            ParseOption(tokens, question, testData, i++, ref checkedCount);
                        }
                        optionParsed = true;
                        break;

                    case "code":
                        if (question is CodeQuestion)
                        {
                            if (!codeParsed)
                            {
                                ParseCode(tokens, question, testData);
                            }
                            else
                            {
                                throw new Exception(string.Format(
                                                        "CodeQuestion поддерживает только один ответ (Quesiton (Row - {0})).", Row));
                            }
                        }
                        else
                        {
                            throw new Exception(
                                      string.Format("Данный тип вопроса не поддерживает code(Quesiton (Row - {0})).",
                                                    Row));
                        }

                        codeParsed = true;
                        break;

                    default:
                        throw new Exception(string.Format("Неизвестный параметр: {0} (Row - {1}).",
                                                          tokens.Peek().Value, tokens.Peek().Row));
                    }
                }
                question.QuestionType = Enum.GetName(typeof(Question.QuestionTypeEnum), type);
                if (question is SingleChoiceQuestion && checkedCount != 1)
                {
                    throw new Exception(string.Format(
                                            "В данном типе вопроса нужно отметить верный один ответ (Quesiton (Row - {0})).", Row));
                }
                if (question is MultiChoiceQuestion && checkedCount < 1)
                {
                    throw new Exception(string.Format(
                                            "В данном типе вопроса нужно отметить хотя бы один верный ответ (Quesiton (Row - {0})).", Row));
                }
                Consume(tokens, "}");
                if (!scoreParsed)
                {
                    question.Score = 1;
                }
                if (!(question is CodeQuestion))
                {
                    if (!textParsed || !optionParsed)
                    {
                        throw new Exception(string.Format(
                                                "Заданы не все требуемые поля (Quesiton (Row - {0})). Text - {1}, Option - {2}.",
                                                Row, textParsed, optionParsed));
                    }
                }
                else if (!textParsed || !codeParsed)
                {
                    throw new Exception(string.Format(
                                            "Заданы не все требуемые поля (Quesiton (Row - {0})). Text - {1}, Code - {2}.",
                                            Row, textParsed, codeParsed));
                }

                testData.Questions.Add(question);
            }
    private void Awake()
    {
        IList <GuiModelBase> myGuiModels = new List <GuiModelBase>();


        /* adding text contents */

        DoubleTextStatement Stat0_0 = new DoubleTextStatement(Color.white, "- 你來了 -",
                                                              "一切,無聲無息,無從解釋", GuiPrefabUtils.DoubleTextFirstGazeDuration,
                                                              GuiPrefabUtils.DoubleTextSecondGazeDuration, vrCamera, myGuiModels);

        Stat0_0.AddPlayAnimationOnDoubleTextGazeComplete(heartBeatAnim);

        SingleTextStatement Stat0_2 = new SingleTextStatement(Color.white,
                                                              "漸漸的,你開始聽到心臟微微跳動\n感受到身體被一種暖流包裹", GuiPrefabUtils.SingleTextGazeDuration,
                                                              vrCamera, myGuiModels);

        Stat0_2.AddPlayAudioOnUiFadeInComplete(GuiPrefabUtils.SceneSoundEffectVolume, true,
                                               heartBeatClip);

        SingleTextStatement Stat0_3 = new SingleTextStatement(Color.white,
                                                              "生命,悄悄滋長 ……", GuiPrefabUtils.SingleTextGazeDuration,
                                                              vrCamera, myGuiModels);

        SingleChoiceQuestion Q1 = new SingleChoiceQuestion(Color.white,
                                                           "你願意來到這個世界\n經歷這一趟人生旅程嗎?", "我願意", vrCamera, myGuiModels);

        /* end of adding text contents */


        /* setting next stories or next scenes */

        Stat0_0.AddNextStory(Stat0_2);
        Stat0_2.AddNextStory(Stat0_3);
        Stat0_3.AddNextStory(Q1);
        Q1.AddNextScene(vrCamera.GetComponent <VRCameraFade>(),
                        GuiPrefabUtils.CameraFadeDuration, SceneSwitchControl.Scene1bName);

        /* end of setting next stories or next scenes */


        /* setting start gui */

        //Stat0_0.SetAsStartGui(storyStartManager);

        // Hard coded here
        NextStory nextStoryOfStartObj =
            SingleChoiceObjectBeforeStart.transform.Find("SelectionSlider").GetComponent <NextStory>();

        nextStoryOfStartObj.nextUiFader           = GuiPrefabUtils.GetUiFader(Stat0_0.underlyingGameObj);
        nextStoryOfStartObj.nextDoubleTextForGaze = GuiPrefabUtils.GetDoubleTextForGaze(Stat0_0.underlyingGameObj);

        /* end of setting start gui */


        /* activating guis */
        // [Important] This is needed because the prefab game objects are set to be inactive so that the OnEnable event is not called during Prefab Instantiation.

        foreach (GuiModelBase myGuiModel in myGuiModels)
        {
            myGuiModel.SetActive(true);
        }

        /* end of activating guis */
    }
    private void Awake()
    {
        IList <GuiModelBase> myGuiModels = new List <GuiModelBase>();


        /* adding text contents */

        DoubleTextStatement Stat2_2_0 = new DoubleTextStatement(Color.white,
                                                                "- 60歲 -", "你開始邁向退休的年紀",
                                                                GuiPrefabUtils.DoubleTextFirstGazeDuration, GuiPrefabUtils.DoubleTextSecondGazeDuration,
                                                                vrCamera, myGuiModels);

        SingleTextStatement Stat2_2_1 = new SingleTextStatement(Color.white,
                                                                "女兒也已經30歲\n到了結婚的年齡", GuiPrefabUtils.SingleTextGazeDuration,
                                                                vrCamera, myGuiModels);

        SingleTextStatement Stat2_3 = new SingleTextStatement(Color.white,
                                                              "看著她也擁有自己的家庭\n你感到放心安慰", GuiPrefabUtils.SingleTextGazeDuration,
                                                              vrCamera, myGuiModels);

        DoubleChoiceQuestion Q2 = new DoubleChoiceQuestion(Color.white,
                                                           "她要搬離你的家\n和她的丈夫一起居住了 ……", "無奈接受", "欣然接受", vrCamera, myGuiModels, SceneSwitchControl.Scene5Q2Name);

        SingleTextStatement Stat3_0 = new SingleTextStatement(Color.white,
                                                              "這時你才發現,原來你不捨得", GuiPrefabUtils.SingleTextGazeDuration,
                                                              vrCamera, myGuiModels);

        SingleTextStatement Stat3_1 = new SingleTextStatement(Color.white,
                                                              "她已經長大了,你無從改變 ……", GuiPrefabUtils.SingleTextGazeDuration,
                                                              vrCamera, myGuiModels);

        DoubleTextStatement Stat3_2_0 = new DoubleTextStatement(Color.white,
                                                                "- 82歲 -", "你患上末期癌症,需要長期進出醫院",
                                                                GuiPrefabUtils.DoubleTextFirstGazeDuration, GuiPrefabUtils.DoubleTextSecondGazeDuration,
                                                                vrCamera, myGuiModels);

        SingleTextStatement Stat3_2_1 = new SingleTextStatement(Color.white,
                                                                "你回來了", GuiPrefabUtils.SingleTextGazeDuration,
                                                                vrCamera, myGuiModels);

        Stat3_2_1.AddPlayAudioOnUiFadeInComplete(GuiPrefabUtils.SceneSoundEffectVolume, false, hospitalCurtainClip);

        SingleTextStatement Stat3_3 = new SingleTextStatement(Color.white,
                                                              "你年老乏力的身體\n就如嬰孩時期般軟弱無力", GuiPrefabUtils.SingleTextGazeDuration,
                                                              vrCamera, myGuiModels);

        scene5Q3ClipSource = Stat3_3.AddPlayAudioOnUiFadeInComplete(GuiPrefabUtils.SceneSoundEffectVolume, true, scene5Q3Clip);

        SingleTextStatement Stat3_4 = new SingleTextStatement(Color.white,
                                                              "當你看到你女兒、女婿、\n孫子、親友全都圍在你床邊\n文珊靠在你床邊,哭成淚人的樣子時 ……",
                                                              6f, vrCamera, myGuiModels);

        SingleTextStatement Stat3_5 = new SingleTextStatement(Color.white,
                                                              "你就意識到自己是差不多走到盡頭了", 4f, vrCamera, myGuiModels);

        SingleTextStatement Stat3_6 = new SingleTextStatement(Color.white,
                                                              "你忽然想起過往很多和文珊的經歷片段", 4f, vrCamera, myGuiModels);

        SingleTextStatement Stat3_7 = new SingleTextStatement(Color.white,
                                                              "第一次約會、第一次吵架、結婚、生小孩、\n一起為工作煩惱、一起為小孩擔憂、\n互相鼓勵、互相安慰 ……",
                                                              6f, vrCamera, myGuiModels);

        DoubleChoiceQuestion Q3 = new DoubleChoiceQuestion(Color.white,
                                                           "慢慢的\n你的臉頰也流下了兩行淚水 ……", "默然不語", "跟文珊說:\n「謝謝你,\n我愛你。」",
                                                           vrCamera, myGuiModels, SceneSwitchControl.Scene5Q3Name);

        Vector3 pos2 = GuiPrefabUtils.GetSelectionSlider2Text(Q3.underlyingGameObj).gameObject.transform.position;

        GuiPrefabUtils.GetSelectionSlider2Text(Q3.underlyingGameObj).gameObject.transform.position = new Vector3(pos2.x, pos2.y + 0.2f, pos2.z);

        SingleTextStatement Stat4_0 = new SingleTextStatement(Color.white,
                                                              "這就是你的理想人生嗎?\n有時你會這樣問自己", 4f,
                                                              vrCamera, myGuiModels);

        scene5Q4ClipSource = Stat4_0.AddPlayAudioOnUiFadeInReachThreshold(0.5f, true, scene5Q4Clip, 0f);

        SingleTextStatement Stat4_1 = new SingleTextStatement(Color.white,
                                                              "漸漸的,你又開始聽到心臟微微的跳動\n感受到身體被一種暖流包裹", 4f,
                                                              vrCamera, myGuiModels);

        Stat4_1UiFader = GuiPrefabUtils.GetUiFader(Stat4_1.underlyingGameObj);
        //heartbeatAudio = Stat4_1.AddPlayAudioOnUiFadeInComplete(GuiPrefabUtils.SceneSoundEffectVolume, true, heartbeatClip);
        Stat4_1.AddPlayAnimationOnUiFadeInComplete(heartbeatAnimationControl);

        SingleTextStatement Stat4_2 = new SingleTextStatement(Color.white,
                                                              "生命,悄悄消逝 ……", 4f,
                                                              vrCamera, myGuiModels);

        SingleChoiceQuestion Q4 = new SingleChoiceQuestion(Color.white,
                                                           "你願意離開這個世界\n結束這一趟人生旅程嗎?", "我願意", vrCamera, myGuiModels);

        Q4UiFader = GuiPrefabUtils.GetUiFader(Q4.underlyingGameObj);
        scene5Q4LoopClipSource  = Q4.AddPlayAudioOnUiFadeInReachThreshold(GuiPrefabUtils.SceneSoundEffectVolume, true, scene5Q4LoopClip, 0f);
        passAwaySelectionSlider = GuiPrefabUtils.GetSelectionSlider(Q4.underlyingGameObj);
        Q4.SetOnFilledAudioClipForSlider(null);

        SingleTextStatement Stat4_A = new SingleTextStatement(Color.white,
                                                              "「我也愛你。」\n文珊抹一抹眼淚,跟你說", 4f,
                                                              vrCamera, myGuiModels);

        SingleTextStatement End_1 = new SingleTextStatement(Color.white,
                                                            "人生 …… 總是經歷選擇、擁有與失去\n你未必可以完全掌控你的人生\n更無法回到過去再來一次",
                                                            GuiPrefabUtils.LastSceneSingleTextGazeDuration, vrCamera, myGuiModels);

        //UIFader End_1UiFader = GuiPrefabUtils.GetUiFader(End_1.underlyingGameObj);
        //End_1UiFader.m_FadeSpeed = 0.2f;

        SingleTextStatement End_2 = new SingleTextStatement(Color.white,
                                                            "但是 …… 以甚麼心態面對人生起跌\n如何與你覺得重要的人相處\n是可以由你來決定",
                                                            GuiPrefabUtils.LastSceneSingleTextGazeDuration, vrCamera, myGuiModels);

        SingleTextStatement End_3 = new SingleTextStatement(Color.white,
                                                            "人,只可活一次!",
                                                            GuiPrefabUtils.LastSceneSingleTextGazeDuration, vrCamera, myGuiModels);

        SingleTextStatement End_4 = new SingleTextStatement(Color.white,
                                                            "回到現實,你會如何繼續你的人生呢?",
                                                            GuiPrefabUtils.LastSceneSingleTextGazeDuration, vrCamera, myGuiModels);

        SingleTextStatement End_5 = new SingleTextStatement(Color.white,
                                                            "(請脫下眼鏡,遵循工作人員指示離開)",
                                                            3600f, vrCamera, myGuiModels);

        //SingleTextStatement

        /* end of adding text contents */


        /* setting next stories or next scenes */

        Stat2_2_0.AddNextStory(Stat2_2_1);
        Stat2_2_1.AddNextStory(Stat2_3);
        Stat2_3.AddNextStory(Q2);
        Q2.AddNextStory(Stat3_0, DoubleChoiceQuestion.SelectionSlider1Or2.Slider1);
        Q2.AddNextStory(Stat3_0, DoubleChoiceQuestion.SelectionSlider1Or2.Slider2);
        Stat3_0.AddNextStory(Stat3_1);
        Stat3_1.AddNextStory(Stat3_2_0);
        Stat3_2_0.AddNextStory(Stat3_2_1);
        Stat3_2_1.AddNextStory(Stat3_3);
        Stat3_3.AddNextStory(Stat3_4);
        Stat3_4.AddNextStory(Stat3_5);
        Stat3_5.AddNextStory(Stat3_6);
        Stat3_6.AddNextStory(Stat3_7);
        Stat3_7.AddNextStory(Q3);
        Q3.AddNextStory(Stat4_0, DoubleChoiceQuestion.SelectionSlider1Or2.Slider1);
        Q3.AddNextStory(Stat4_A, DoubleChoiceQuestion.SelectionSlider1Or2.Slider2);
        Stat4_0.AddNextStory(Stat4_1);
        Stat4_1.AddNextStory(Stat4_2);
        Stat4_2.AddNextStory(Q4);
        Stat4_A.AddNextStory(Stat4_0);
        //Q4.AddNextScene(vrCamera.GetComponent<VRCameraFade>(),
        //    GuiPrefabUtils.CameraFadeDuration, SceneSwitchControl.Scene5dName);
        Q4.AddNextStory(End_1);
        End_1.AddNextStory(End_2);
        End_2.AddNextStory(End_3);
        End_3.AddNextStory(End_4);
        End_4.AddNextStory(End_5);

        /* end of setting next stories or next scenes */


        /* setting start gui */

        Stat2_2_0.SetAsStartGui(storyStartManager);

        /* end of setting start gui */


        /* activating guis */
        // [Important] This is needed because the prefab game objects are set to be inactive so that the OnEnable event is not called during Prefab Instantiation.

        foreach (GuiModelBase myGuiModel in myGuiModels)
        {
            myGuiModel.SetActive(true);
        }

        /* end of activating guis */
    }
        public async Task <IActionResult> AddSingleChoiceQuestion([FromBody] AddSingleChoiceQuestionViewModel model)
        {
            var user = await _userManager.GetUserAsync(HttpContext.User);

            var test = await _context.Tests.SingleOrDefaultAsync(t => t.Id == (int)RouteData.Values["testId"]);

            if (test == null)
            {
                return(NotFound());
            }

            if (test.CreatedBy != user)
            {
                return(Forbid());
            }

            model.TestId = test.Id;
            TryValidateModel(model);
            if (ModelState.IsValid)
            {
                // транзакция
                using (var ts = _context.Database.BeginTransaction())
                {
                    var question = new SingleChoiceQuestion
                    {
                        Title        = model.Title,
                        QuestionType = Enum.GetName(typeof(Question.QuestionTypeEnum), 1),
                        Test         = test,
                        Score        = model.Score
                    };
                    //создать в базе вопрос
                    var questionCreated = (await _context.AddAsync(question)).Entity;
                    await _context.SaveChangesAsync(); //применить изменения

                    foreach (var option in model.Options)
                    {
                        // добавить в базу Options
                        var optionCreated = (await _context.AddAsync(
                                                 new Option {
                            IsRight = option.IsRight, Text = option.Text, Question = questionCreated
                        }))
                                            .Entity;
                        //questionCreated.Options.Add(optionCreated);

                        if (optionCreated.IsRight)
                        {
                            questionCreated.RightAnswer = optionCreated;
                        }
                    }

                    // обновить вопрос и применить изменения
                    _context.Questions.Update(questionCreated);
                    await _context.SaveChangesAsync();

                    ts.Commit();
                }

                var redirectUrl = Url.Action("Details", "Test", new { id = test.Id });
                return(new JsonResult(redirectUrl));
            }

            var errors = new List <ModelError>();

            foreach (var modelState in ViewData.ModelState.Values)
            {
                foreach (var error in modelState.Errors)
                {
                    errors.Add(error);
                }
            }
            Response.StatusCode = StatusCodes.Status400BadRequest;
            return(new JsonResult(errors));
        }
        public void GivenTheSurveyHasTheQuestionWithTheAnswers(string questionText, string answers)
        {
            SurveySays.Domain.Api.Survey survey = ScenarioContext.Current["Survey"] as SurveySays.Domain.Api.Survey;

            SingleChoiceQuestion question = new SingleChoiceQuestion(questionText);
            PopulateAnswers(question, answers);
            survey.AddQuestion(question);
        }