コード例 #1
0
ファイル: TableSteps.cs プロジェクト: jeffgaroutte/SurveySays
        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;
        }
コード例 #2
0
 private void PopulateAnswers(ChoiceQuestion question, string answers)
 {
     foreach (var answer in answers.Split(','))
     {
         string cleanAnswer = answer.Trim();
         Choice choice = new Choice() { DisplayText = cleanAnswer, Value = cleanAnswer, Id = Guid.NewGuid() };
         question.AddChoice(choice);
     }
 }
コード例 #3
0
 public bool IsChoiceSelected(Choice choice)
 {
     return this.Answer != null &&
         this.Answer.Id.Equals(choice.Id);
 }