Beispiel #1
0
        /// <summary>
        /// sets the answer choice list
        /// </summary>
        /// <param name="answerChoice">list of answer choices</param>
        public void SetAnswerChoiceList(List <string> answerChoice)
        {
            AnswerChoiceList = new List <AnswerLineItem>();
            AnswerChoiceGrid.Wait(3);
            AnswerContentWebElementList = AnswerContentRows.WaitForElements(5);

            if (Driver.WrappedDriver.GetType() == typeof(DummyDriver))
            {
                AnswerContentWebElementList = GetDummyIdentifiers();
            }

            if (ItemType == ItemType.TrueFalse)
            {
                answerChoice = new List <string>()
                {
                    "True", "False"
                };
            }

            foreach (var webElement in AnswerContentWebElementList)
            {
                string answer = webElement.Text.Trim();
                if (answerChoice.Contains(answer))
                {
                    int index = answerChoice.IndexOf(answer);
                    Report.Write("AnswerLineItem index: '" + index + "'; question: '" + answer);
                    var answerLineItem = new AnswerLineItem(ItemType, index, answer);
                    AnswerChoiceList.Add(answerLineItem);
                }
                else
                {
                    throw new Exception("Expected to find the answer: '" + answer + "', but it does not exist in the answer choices.");
                }
            }
        }
Beispiel #2
0
        /// <summary>
        /// sets the answer choice list
        /// </summary>
        public void SetAnswerChoiceList()
        {
            AnswerChoiceList = new List <AnswerLineItem>();
            AnswerChoiceGrid.Wait(3);
            AnswerContentWebElementList = AnswerContentRows.WaitForElements(5);

            if (Driver.WrappedDriver.GetType() == typeof(DummyDriver))
            {
                AnswerContentWebElementList = GetDummyIdentifiers();
            }

            int index = 0;

            foreach (var webElement in AnswerContentWebElementList)
            {
                string answer = webElement.Text.Trim();
                Report.Write("AnswerLineItem index: '" + index + "'; question: '" + answer);
                var answerLineItem = new AnswerLineItem(ItemType, index, answer);
                AnswerChoiceList.Add(answerLineItem);
                index++;
            }
        }