Example #1
1
        public void ThreeIsNotCorrectBullsCountFor9734()
        {
            Bull bullTest = new Bull("9734", "9943", new bool[4]);
            string actual = bullTest.GetPrintableCount();

            Assert.AreNotEqual("Bulls: 3 ", actual, "Bull counting logic problem.");
        }
Example #2
0
        public void OneIsNotCorrectBullsCountFor2901()
        {
            Bull bullTest = new Bull("2901", "2400", new bool[4]);
            string actual = bullTest.GetPrintableCount();

            Assert.AreNotEqual("Bulls: 1 ", actual, "Bull counting logic problem.");
        }
Example #3
0
        public void FourIsCorrectBullsCountFor0000()
        {
            Bull bullTest = new Bull("0000", "0000", new bool[4]);
            string actual = bullTest.GetPrintableCount();

            Assert.AreEqual("Bulls: 4 ", actual, "Bull counting logic problem.");
        }
Example #4
0
        public void OneIsCorrectBullsCountFor3331()
        {
            Bull bullTest = new Bull("3331", "3462", new bool[4]);
            string actual = bullTest.GetPrintableCount();

            Assert.AreEqual("Bulls: 1 ", actual, "Bull counting logic problem.");
        }
Example #5
0
        public void TwoIsCorrectBullsCountFor2653()
        {
            Bull bullTest = new Bull("2653", "2352", new bool[4]);
            string actual = bullTest.GetPrintableCount();

            Assert.AreEqual("Bulls: 2 ", actual, "Bull counting logic problem.");
        }
Example #6
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);
            }
        }