예제 #1
0
        public void TestingCurentPlayerNameMark_IsSameORNot()
        {
            Game game = new TicTacToeLib.Game();

            game.Play(0);
            game.Play(1);
            game.Play(2);
            var result = game.Player.Mark;

            Assert.AreEqual(Mark.O, result);
        }
예제 #2
0
        public void TestingOnGoing()
        {
            Game game = new TicTacToeLib.Game();

            game.Play(0);
            game.Play(2);
            game.Play(3);
            var result = game.Status;

            Assert.AreEqual(Result.ONGOING, result);
        }
예제 #3
0
        public void TestingCurentPlayerName_IsSameOrNot()
        {
            Game game = new TicTacToeLib.Game();

            game.Play(0);
            game.Play(1);
            game.Play(2);
            var result = game.Player.Name;

            Assert.AreEqual("priyank", result);
        }
예제 #4
0
        public void TestingWiningCase()
        {
            Game game = new TicTacToeLib.Game();

            game.Play(1);
            game.Play(2);
            game.Play(3);
            game.Play(4);
            game.Play(8);
            game.Play(6);

            var result = game.Status;

            Assert.AreEqual(Result.WIN, result);
        }
예제 #5
0
        public void TestingDrawCase()
        {
            Game game = new TicTacToeLib.Game();

            game.Play(0);
            game.Play(1);
            game.Play(2);
            game.Play(4);
            game.Play(3);
            game.Play(5);
            game.Play(7);
            game.Play(6);
            game.Play(8);
            var result = game.Status;

            Assert.AreEqual(Result.DRAW, result);
        }
예제 #6
0
        public void TestingExceptionForSameClick()
        {
            Game      game = new TicTacToeLib.Game();
            Exception expectedexception = null;

            try
            {
                game.Play(0);
                game.Play(1);
                game.Play(2);
                game.Play(4);
                game.Play(3);
                game.Play(5);
                game.Play(1);
            }
            catch (Exception exception)
            {
                expectedexception = exception;
            }

            Assert.IsNotNull(expectedexception);
        }