示例#1
0
        public void GMCheckWinTest()
        {
            int testNumDigits = 4,
                testNumCorrect1 = 4,
                testNumCorrect2 = 3;
            long testCurrNumJum = 1234;
            long testCurrGuess = 1111;
            bool testStatus = false;

            JumbledNumber testNumJum = new JumbledNumber(testNumDigits, testCurrNumJum, testCurrGuess, 0, 0, true);
            Player testPlayer = new Player("Link");

            GameManager testGameManager = new GameManager();

            // Set win condition and test
            testNumJum.NumCorrect = testNumCorrect1;

            testStatus = testGameManager.CheckWin(testNumJum, testPlayer);
            Assert.IsTrue(testStatus);

            // Set win condition and test
            testNumJum.NumCorrect = testNumCorrect2;

            testStatus = testGameManager.CheckWin(testNumJum, testPlayer);
            Assert.IsFalse(testStatus);
        }
示例#2
0
        public void GMCheckGuessTest()
        {
            int testNumDigits = 4;
            long testCurrNumJum = 1234;
            long testCurrGuess = 1111;

            JumbledNumber testNumJum = new JumbledNumber();

            testNumJum.JNumberValue = testCurrNumJum;
            testNumJum.CurGuess = testCurrGuess;
            testNumJum.NumDigits = testNumDigits;

            Console.WriteLine("Stored NumJum " + testNumJum.JNumberValue.ToString());
            Console.WriteLine("Stored Guess " + testNumJum.CurGuess.ToString());

            GameManager testGameManager = new GameManager();

            testGameManager.CheckGuess(testNumJum, testCurrGuess);

            Assert.AreEqual(1, testNumJum.NumCorrect);
        }
示例#3
0
        public void GMStartGameTest()
        {
            string testName = "Link";
            int testDiff = 1,
                testNumdigts = 0;

            Player testPlayer = new Player(testName);

            JumbledNumber testNumJum = new JumbledNumber();

            GameManager testGameManager = new GameManager();

            testNumdigts = testGameManager.StartGame(testNumJum, testDiff);

            Console.WriteLine("Generated Number is: " + testNumJum.JNumberValue.ToString());
            Console.WriteLine("Player Name is: " + testPlayer.PlayerName);
            Console.WriteLine("Game status is: " + testNumJum.GameInProgress.ToString());

            Assert.IsTrue((testNumdigts > 0));
            Assert.IsTrue(testNumJum.GameInProgress);
        }
示例#4
0
        public void GMStopGameTest()
        {
            JumbledNumber testNumJum = new JumbledNumber();

            GameManager testGameManager = new GameManager();

            testGameManager.StopGame(testNumJum);

            Assert.IsFalse(testNumJum.GameInProgress);
        }