コード例 #1
0
        public void ReturnsQuestionForGivenUserId()
        {
            INumberGenerator    numberGenerator = new NumberGenerator();
            ExcerciseController controller      = new ExcerciseController(numberGenerator);
            var question = controller.Get("2");

            Assert.IsNotNull(question);
        }
コード例 #2
0
        public void DefaultsUserIdAndReturnsQuestion()
        {
            INumberGenerator    numberGenerator = new NumberGenerator();
            ExcerciseController controller      = new ExcerciseController(numberGenerator);
            var question = controller.Get(string.Empty);

            Assert.IsNotNull(question);
        }
コード例 #3
0
        public void ReducesTimeRemainingForRepeatQuestionSameUserId()
        {
            INumberGenerator    numberGenerator = new NumberGenerator();
            ExcerciseController controller      = new ExcerciseController(numberGenerator);

            const string userId = "3";

            var question = controller.Get(userId);

            Assert.IsNotNull(question);
            Assert.AreEqual(question.secondsRemaining, 20);

            var question2 = controller.Get(userId);

            Assert.IsNotNull(question2);
            Assert.AreEqual(question2.secondsRemaining, 19);

            var question3 = controller.Get(userId);

            Assert.IsNotNull(question3);
            Assert.AreEqual(question3.secondsRemaining, 18);
        }