コード例 #1
0
 public void StartNewGame()
 {
     _codeChecker.GenerateSecretCode();
     IsWinner   = false;
     IsGameOver = false;
     Turns      = new List <Turn>();
 }
コード例 #2
0
        public void It_Should_Return_WhiteForEveryCorrectColourAtIncorrectPosition_When_Given_ValidGuesses(List <Peg> guess, List <Feedback> expectedFeedback)
        {
            //arrange
            var codeGenerator = new CodeGenerator(new List <Peg> {
                Peg.Red, Peg.Blue, Peg.Green, Peg.Yellow
            });
            var nonRandomizer = new NonRandomizer();
            var code          = new CodeChecker(codeGenerator, nonRandomizer);

            code.GenerateSecretCode();

            //act
            var feedback = code.CheckGuess(guess);

            //assert
            Assert.Equal(expectedFeedback, feedback);
        }
コード例 #3
0
        public void It_Should_Return_A_KnownSecretCode_When_A_StaticCodeGeneratorIsUsed()
        {
            //arrange
            var codeGenerator = new CodeGenerator(new List <Peg> {
                Peg.Red, Peg.Blue, Peg.Green, Peg.Yellow
            });
            var nonRandomizer = new NonRandomizer();
            var code          = new CodeChecker(codeGenerator, nonRandomizer);

            //act
            code.GenerateSecretCode();

            //assert
            var expectedSecretCode = new List <Peg> {
                Peg.Red, Peg.Blue, Peg.Green, Peg.Yellow
            };

            Assert.True(code.SecretCode.SequenceEqual(expectedSecretCode));
        }