Exemple #1
0
        public void TestFindBullsAndCowsCountForInputWithSpacesBetweenDigits()
        {
            BullsAndCowsGame_Accessor game =
                SetSecretNumberDigits(0, 0, 0, 0);
            string userNumber = "1 2 3 5";

            Result actual = game.FindBullsAndCowsCount(userNumber);
        }
Exemple #2
0
        public void TestFindBullsAndCowsCountFor3DigitsAnd1Letter()
        {
            BullsAndCowsGame_Accessor game =
                SetSecretNumberDigits(0, 0, 0, 0);
            string userNumber = "123a";

            Result actual = game.FindBullsAndCowsCount(userNumber);
        }
Exemple #3
0
        public void TestFindBullsAndCowsCountFor1BullByEqualDigits()
        {
            BullsAndCowsGame_Accessor game =
                SetSecretNumberDigits(0, 0, 0, 0);
            string userNumber = "0143";

            Result expected = new Result(1, 0);
            Result actual   = game.FindBullsAndCowsCount(userNumber);

            Assert.AreEqual <Result>(expected, actual,
                                     INCORRECT_COUNT_OF_BULLS_AND_COWS_MSG);
        }
Exemple #4
0
        public void TestGetStartValuesGuessesCount()
        {
            BullsAndCowsGame_Accessor game = new BullsAndCowsGame_Accessor();

            game.FindBullsAndCowsCount("9999");
            game.GetStartValues();

            int expected = 0;
            int actual   = game.GuessesCount;

            Assert.AreEqual <int>(expected, actual,
                                  "GetStartValues didn't intialize the guess count properly!");
        }
Exemple #5
0
        public void TestExecuteCommandRestartCorrect()
        {
            BullsAndCowsGame_Accessor game = SetSecretNumberDigits(1, 2, 3, 4);

            game.FindBullsAndCowsCount("0000");
            game.ExecuteCommand(null, "0000");
            game.ExecuteCommand(null, "restart");

            int expected = 0;
            int actual   = game.GuessesCount;

            Assert.AreEqual <int>(expected, actual,
                                  EXECUTING_COMMAND_ERROR_MSG);
        }