Example #1
1
        public void OneIsCorrectCowsCountFor1786()
        {
            bool[] isBull = new bool[4];
            Bull bullTest = new Bull("1786", "6187", isBull);
            Cow cowTest = new Cow("1786", "6187", isBull);
            string actual = cowTest.GetPrintableCount();

            Assert.AreEqual("Cows: 4", actual, "Cow counting logic problem.");
        }
Example #2
0
        public void ZeroIsNotCorrectCowsCountFor1923()
        {
            bool[] isBull = new bool[4];
            Bull bullTest = new Bull("1923", "1093", isBull);
            Cow cowTest = new Cow("1923", "1093", isBull);
            string actual = cowTest.GetPrintableCount();

            Assert.AreNotEqual("Cows: 0", actual, "Cow counting logic problem.");
        }
Example #3
0
        public void ThreeIsCorrectCowsCountFor2996()
        {
            bool[] isBull = new bool[4];
            Bull bullTest = new Bull("2296", "2296", isBull);
            Cow cowTest = new Cow("2296", "2292", isBull);
            string actual = cowTest.GetPrintableCount();

            Assert.AreEqual("Cows: 3", actual, "Cow counting logic problem.");
        }
Example #4
0
        public void SevenIsNotCorrectCowsCountFor9067()
        {
            bool[] isBull = new bool[4];
            Bull bullTest = new Bull("9067", "0185", isBull);
            Cow cowTest = new Cow("9067", "0185", isBull);
            string actual = cowTest.GetPrintableCount();

            Assert.AreNotEqual("Cows: 7", actual, "Cow counting logic problem.");
        }
Example #5
0
 public void EmptyTryNumberIsNotAllowed()
 {
     Cow cowllTest = new Cow("4390", null, new bool[4]);
 }
Example #6
0
 public void EmptyNumberForGuessIsNotAllowed()
 {
     Cow cowllTest = new Cow(null, "3462", new bool[4]);
 }
Example #7
0
 public void EmptyBoolArrayForBullsIsNotAllowed()
 {
     Cow cowllTest = new Cow("5331", "2178", null);
 }
Example #8
0
        private void ProcessNextMove(string numberToTry)
        {
            this.numberOfMoves++;
            if (this.numberToGuess.IsEqualToNumberForTry(numberToTry))
            {
                this.isGuessed = true;
                UserInterface.PrintCongratulationMessage(this.numberOfMoves, this.numberOfCheats);
            }
            else
            {
                bool[] isBull = new bool[4];
                Bull bull = new Bull(this.numberToGuess.Value, numberToTry, isBull);
                Cow cow = new Cow(this.numberToGuess.Value, numberToTry,isBull);

                Console.Write("Wrong number! ");
                string bullCount = bull.GetPrintableCount();
                Console.Write(bullCount);
                string cowCount = cow.GetPrintableCount();
                Console.WriteLine(cowCount);
            }
        }