Ejemplo n.º 1
0
        public void ProccessGues_Secret1234Guess1243_2Bull2Cow()
        {
            // Arrange
            BullsAndCows game = new BullsAndCows();
            int bulls = 0;
            int cows = 0;
            int[] secret = { 1, 2, 3, 4 };
            string guess = "1243";

            // Act
            game.ProccessGues(secret, guess, out bulls, out cows);

            // Assert
            Assert.IsTrue(cows == 2 && bulls == 2);
        }
Ejemplo n.º 2
0
        public void ProccessGues_Secret1234Guess1234_ShouldNeverReturn3Bull1Cow()
        {
            // Arrange
            BullsAndCows game = new BullsAndCows();
            int bulls = 0;
            int cows = 0;
            int[] secret = { 1, 2, 3, 4 };
            string guess = "1234";

            // Act
            game.ProccessGues(secret, guess, out bulls, out cows);

            // Assert
            Assert.IsFalse(cows == 3 && bulls == 1);
        }
Ejemplo n.º 3
0
        public void ShouldBeEqual_ifGuessLengthHasExpectedLength()
        {
            // Arrange
            BullsAndCows game = new BullsAndCows();
            int bulls = 0;
            int cows = 0;
            int[] secret = { 1, 1, 1, 1 };
            string guess = "1234";

            // Act
            bool isValidGuess = game.ProccessGues(secret, guess, out bulls, out cows);

            // Assert
            Assert.AreEqual(guess.Length == BullsAndCows.NUMBER_OF_DIGITS, isValidGuess);
        }
Ejemplo n.º 4
0
        public void ProccessGues_Secret5694Guess5555_1Bull0Cow()
        {
            // Arrange
            BullsAndCows game = new BullsAndCows();
            int bulls = 0;
            int cows = 0;
            int[] secret = { 5, 6, 9, 4 };
            string guess = "5555";

            // Act
            game.ProccessGues(secret, guess, out bulls, out cows);

            // Assert
            Assert.IsTrue(cows == 0 && bulls == 1);
        }
Ejemplo n.º 5
0
        public void ProccessGues_Secret2424Guess4144_1Bull1Cow()
        {
            // Arrange
            BullsAndCows game = new BullsAndCows();
            int bulls = 0;
            int cows = 0;
            int[] secret = { 2, 4, 2, 4 };
            string guess = "4144";

            // Act
            game.ProccessGues(secret, guess, out bulls, out cows);

            // Assert
            Assert.IsTrue(cows == 1 && bulls == 1);
        }
Ejemplo n.º 6
0
        public void ProccessGues_Secret1234Guess5678_0Bull0Cow()
        {
            // Arrange
            BullsAndCows game = new BullsAndCows();
            int bulls = 0;
            int cows = 0;
            int[] secret = { 1, 2, 3, 4 };
            string guess = "5678";

            // Act
            game.ProccessGues(secret, guess, out bulls, out cows);

            // Assert
            Assert.IsTrue(cows == 0 && bulls == 0);
        }