Esempio n. 1
0
        public void InitializeOptions_GetsNoTrue_ArgumentException()
        {
            //Arrange
            var options = new List <SingleSelectionQuestionOption>()
            {
                new SingleSelectionQuestionOption("1st option (false)", false),
                new SingleSelectionQuestionOption("2nd option (false)", false)
            };
            var singleSelectionQuestion = new SingleSelectionQuestion("Question text");

            //Act
            //Assert
            Assert.Throws <ArgumentException>(() => singleSelectionQuestion.InitializeOptions(options));
        }
Esempio n. 2
0
        public void GetRightAnswer_ReturnsTrueOption()
        {
            //Arrange
            var theTrueOption = new SingleSelectionQuestionOption("2nd option (true)", true);
            var options       = new List <SingleSelectionQuestionOption>()
            {
                new SingleSelectionQuestionOption("1st option (false)", false),
                theTrueOption,
                new SingleSelectionQuestionOption("3rd option (false)", false),
                new SingleSelectionQuestionOption("4th option (false)", false)
            };
            var singleSelectionQuestion = new SingleSelectionQuestion("Question text");

            singleSelectionQuestion.InitializeOptions(options);

            //Act
            var answer = singleSelectionQuestion.GetRightAnswer();

            //Assert
            Assert.True(answer.IsAnswer);
            Assert.Equal(theTrueOption.Text, answer.Text);
        }