示例#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.");
        }
示例#2
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.");
        }
示例#3
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.");
        }
示例#4
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.");
        }
示例#5
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.");
        }
示例#6
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.");
        }
示例#7
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.");
        }
示例#8
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.");
        }
示例#9
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.");
        }
示例#10
0
 public void EmptyBoolArrayForBullsIsNotAllowed()
 {
     Bull bullTest = new Bull("5331", "2178", null);
 }
示例#11
0
 public void EmptyTryNumberIsNotAllowed()
 {
     Bull bullTest = new Bull("4390", null, new bool[4]);
 }
示例#12
0
 public void EmptyNumberForGuessIsNotAllowed()
 {
     Bull bullTest = new Bull(null, "3462", new bool[4]);   
 }
示例#13
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);
            }
        }