コード例 #1
0
        public void WhenIsSkippedFlagAsSkipped()
        {
            // Arrange
            var mockSpeachService = new Mock <ISpeachService>();
            var spellings         = new ObservableCollection <SpellingViewModel>();
            var s = new Spelling()
            {
                Word = "Dog", ContextSentence = "The dog and bone"
            };
            var svm = new SpellingViewModel(s);

            spellings.Add(svm);

            var sut = new SpellTestService(spellings, mockSpeachService.Object);

            sut.NextQuestion();

            // Act
            sut.SkipQuestion();


            // Assert
            Assert.Equal(svm.CorrectCount, 0);
            Assert.Equal(svm.ErrorCount, 0);
            Assert.Equal(svm.Skipped, true);
        }
コード例 #2
0
        public void Next_Should_Return_Null_When_All_Answered()
        {
            // Arrange
            var mockSpeachService = new Mock <ISpeachService>();
            var spellings         = new ObservableCollection <SpellingViewModel>();
            var s = new Spelling()
            {
                Word = "Dog", ContextSentence = "The dog and bone"
            };
            var svm = new SpellingViewModel(s);

            spellings.Add(svm);

            var sut = new SpellTestService(spellings, mockSpeachService.Object);
            var q   = sut.NextQuestion();

            // Act
            q = sut.AnswerQuestion("Dog");

            // Assert
            Assert.Null(q);

            q = sut.NextQuestion();
            Assert.Null(q);
        }
コード例 #3
0
        public void WhenIsAnsweredIncorrectlyErrorCountIncreases()
        {
            // Arrange
            var mockSpeachService = new Mock <ISpeachService>();
            var spellings         = new ObservableCollection <SpellingViewModel>();
            var s = new Spelling()
            {
                Word = "Dog", ContextSentence = "The dog and bone"
            };
            var svm = new SpellingViewModel(s);

            spellings.Add(svm);

            var sut = new SpellTestService(spellings, mockSpeachService.Object);

            sut.NextQuestion();

            // Act
            sut.AnswerQuestion("Dogg");


            // Assert
            Assert.Equal(svm.CorrectCount, 0);
            Assert.Equal(svm.ErrorCount, 1);
            Assert.Equal(svm.Skipped, false);
        }