Ejemplo n.º 1
0
            public void a_CorrectPiece_cannot_be_reevaluated_by_a_Subset_feedback_generator_if_it_is_ouside_of_its_scope()
            {
                Puzzle puzzle = createPuzzle(new List <string> {
                    "One-White",
                    "One-White",
                    "Two-White",
                    "Two-White",
                    "Three-White",
                    "Three-White"
                });
                FeedbackGenerator sut = new FeedbackGenerator(puzzle, new List <int> {
                    1, 2, 3, 4
                });
                Guess guess = createGuess(new List <string> {
                    "Four-White",
                    "Four-White",
                    "Four-White",
                    "Three-White",
                    "Three-White",
                    "Three-White"
                });

                var actualFeedback = sut.Calculate(guess);

                Assert.AreEqual(1, actualFeedback.CorrectPieces);
            }
Ejemplo n.º 2
0
        public void Calculate_throws_exception_if_guess_count_not_match_puzzle_count()
        {
            int puzzleCount                    = 4;
            FeedbackGenerator sut_1            = new FeedbackGenerator(new Puzzle(puzzleCount), new List <int>());
            var nonMatchingGuessCount_lower_1  = new Guess(puzzleCount - 1);
            var nonMatchingGuessCount_higher_1 = new Guess(puzzleCount + 1);

            Assert.Throws <InvalidOperationException>(() => sut_1.Calculate(nonMatchingGuessCount_lower_1));
            Assert.Throws <InvalidOperationException>(() => sut_1.Calculate(nonMatchingGuessCount_higher_1));

            OverallFeedbackGenerator sut_2     = new OverallFeedbackGenerator(new Puzzle(puzzleCount));
            var nonMatchingGuessCount_lower_2  = new Guess(puzzleCount - 1);
            var nonMatchingGuessCount_higher_2 = new Guess(puzzleCount + 1);

            Assert.Throws <InvalidOperationException>(() => sut_2.Calculate(nonMatchingGuessCount_lower_2));
            Assert.Throws <InvalidOperationException>(() => sut_2.Calculate(nonMatchingGuessCount_higher_2));
        }
Ejemplo n.º 3
0
            public void A_guess_piece_is_Similar_when_it_has_same_symbol_as_its_corresponding_puzzle_piece_but_with_different_color()
            {
                Puzzle puzzle = createPuzzle(new List <string> {
                    "One-Black"
                });
                Guess guess = createGuess(new List <string> {
                    "One-White"
                });
                FeedbackGenerator sut = new FeedbackGenerator(puzzle, new List <int> {
                    0
                });

                var actualFeedback = sut.Calculate(guess);

                Assert.AreEqual(0, actualFeedback.CorrectPieces);
                Assert.AreEqual(1, actualFeedback.SimilarPieces);
            }