コード例 #1
0
        public void GetBullsAndCows_Valid_Bulls_TwoBulls()
        {
            GameNumber number = new GameNumber();

            string userInput = "4194";
            string genNumber = "0154";
            int cows = 0;
            int bulls = 0;
            number.GetBullsAndCows(userInput, genNumber, out bulls, out cows);
            Assert.IsTrue(cows == 0 && bulls == 2);
        }
コード例 #2
0
        public void GetBullsAndCows_Valid_CowsTest()
        {
            GameNumber number = new GameNumber();

            string userInput = "4199";
            string genNumber = "1400";
            int cows = 0;
            int bulls = 0;
            number.GetBullsAndCows(userInput, genNumber, out bulls, out cows);
            Assert.IsTrue(cows == 2 && bulls == 0);
        }
コード例 #3
0
 public void GenerateNumber_Valid_InRange()
 {
     GameNumber number = new GameNumber();
     int parsedNumber = int.Parse(number.Digits);
     Assert.IsTrue(parsedNumber >= 0 && parsedNumber <= 9999);
 }
コード例 #4
0
        public void RevealDigit_isTrue()
        {
            GameNumber number = new GameNumber();

            Assert.IsTrue(number.RevealDigit(1));
        }
コード例 #5
0
 public void GenerateNumber_Valid_4digits()
 {
     GameNumber number = new GameNumber();
     Assert.IsTrue(number.Digits.Length == 4);
 }
コード例 #6
0
        public void RevealDigit_isFalse()
        {
            GameNumber number = new GameNumber();

            Assert.IsFalse(number.RevealDigit(4));
        }
コード例 #7
0
        public void GetBullsAndCows_Valid_TwoBullsAndTwoCows2()
        {
            GameNumber number = new GameNumber();

            string userInput = "0101";
            string genNumber = "1001";
            int cows = 0;
            int bulls = 0;
            number.GetBullsAndCows(userInput, genNumber, out bulls, out cows);
            Assert.IsTrue(cows == 2 && bulls == 2);
        }