コード例 #1
0
        public void PreventIndexOutOfBounds()
        {
            Quiz quiz = SimpleQuizTestFixture.BuildSimpleQuiz();

            quiz.PreviousQuestion();
            Assert.AreEqual(1, quiz.CurrentQuestionNumber);
            quiz.NextQuestion();
            Assert.AreEqual(2, quiz.CurrentQuestionNumber);
            quiz.NextQuestion();
            Assert.AreEqual(2, quiz.CurrentQuestionNumber);
        }
コード例 #2
0
        public void InitializeState()
        {
            Quiz quiz = SimpleQuizTestFixture.BuildSimpleQuiz();

            Assert.AreEqual(2, quiz.NumberOfQuestions);
            Assert.AreEqual(0, quiz.Score);
            Assert.AreEqual(0, quiz.CorrectAnswers);
            Assert.AreEqual(1, quiz.CurrentQuestionNumber);
            Assert.IsTrue(quiz.OnFirstQuestion);
            Assert.IsFalse(quiz.OnLastQuestion);
        }
コード例 #3
0
        public void AnswerFirstQuestionCorrectly()
        {
            Quiz     quiz     = SimpleQuizTestFixture.BuildSimpleQuiz();
            Question question = quiz.CurrentQuestion;

            Assert.AreEqual(Question1Text, quiz.CurrentQuestion.QuestionText);
            Assert.AreEqual("2", question.AnswerOptions[0]);
            Assert.AreEqual("4", question.AnswerOptions[1]);
            Assert.AreEqual("5", question.AnswerOptions[2]);
            question.SelectAnswerOption = 1;

            Assert.AreEqual(1, quiz.CorrectAnswers);
        }
コード例 #4
0
        public void MovingToPreviousQuestion()
        {
            Quiz quiz = SimpleQuizTestFixture.BuildSimpleQuiz();

            quiz.NextQuestion();
            Assert.AreEqual(2, quiz.CurrentQuestionNumber);
            quiz.PreviousQuestion();

            Question question = quiz.CurrentQuestion;

            Assert.AreEqual(Question1Text, quiz.CurrentQuestion.QuestionText);
            Assert.AreEqual(1, quiz.CurrentQuestionNumber);
            Assert.IsTrue(quiz.OnFirstQuestion);
            Assert.IsFalse(quiz.OnLastQuestion);
        }
コード例 #5
0
        public void MovingToNextQuestion()
        {
            Quiz quiz = SimpleQuizTestFixture.BuildSimpleQuiz();

            quiz.NextQuestion();

            Question question = quiz.CurrentQuestion;

            Assert.AreEqual(Question2Text, question.QuestionText);
            Assert.AreEqual("6", question.AnswerOptions[0]);
            Assert.AreEqual("8", question.AnswerOptions[1]);
            Assert.AreEqual("9", question.AnswerOptions[2]);
            Assert.AreEqual(2, quiz.CurrentQuestionNumber);
            Assert.IsFalse(quiz.OnFirstQuestion);
            Assert.IsTrue(quiz.OnLastQuestion);
        }