示例#1
0
        public void TTT_GetNextPlayer_TheSecondPlayer()
        {
            TicTacTeo ttt = new TicTacTeo();

            ttt.NextPlayer();
            Assert.Equal('O', ttt.NextPlayer());
        }
示例#2
0
        public void TTT_matrixSameCell_Exception()
        {
            TicTacTeo ttt = new TicTacTeo();

            ttt.Play(1, 1);
            Assert.Throws <InvalidOperationException>(() => ttt.Play(1, 1));
        }
示例#3
0
        public void TTT_XisWinnerHorizontal_succes()
        {
            TicTacTeo ttt = new TicTacTeo();

            ttt.Play(1, 1); // x
            ttt.Play(2, 2); //O
            ttt.Play(1, 2); //x
            ttt.Play(3, 3); //o
            Assert.Equal("X is Winner", ttt.Play(1, 3));
        }
示例#4
0
        public void TTT_XisWinnerVertically_succes()
        {
            TicTacTeo ttt = new TicTacTeo();

            ttt.Play(1, 1); // x
            ttt.Play(2, 2); //O
            ttt.Play(2, 1); //x
            ttt.Play(3, 3); //o
            Assert.Equal("X is Winner", ttt.Play(3, 1));
        }
示例#5
0
        public void TTT_OisWinnerHorizantal_succes()
        {
            TicTacTeo ttt = new TicTacTeo();

            ttt.Play(2, 2);                              // x
            ttt.Play(1, 1);                              //O
            ttt.Play(2, 3);                              //x
            ttt.Play(1, 2);                              //o
            ttt.Play(3, 1);                              //x
            Assert.Equal("O is Winner", ttt.Play(1, 3)); //Object is winner
        }
示例#6
0
        public void TTT_OisWinnerDraw_succes()
        {
            TicTacTeo ttt = new TicTacTeo();

            ttt.Play(1, 1);                             // x
            ttt.Play(2, 2);                             //O
            ttt.Play(3, 3);                             //x
            ttt.Play(3, 1);                             //x
            ttt.Play(3, 2);                             //o
            ttt.Play(1, 3);                             //o

            ttt.Play(1, 2);                             //x

            ttt.Play(2, 3);                             //x

            Assert.Equal("Its a Draw", ttt.Play(2, 1)); //Object is winner
        }
示例#7
0
        public void TTT_matrixValueGreater_OutOfRange()
        {
            TicTacTeo ttt = new TicTacTeo();

            Assert.Throws <InvalidOperationException>(() => ttt.Play(5, 5));
        }
示例#8
0
        public void TTT_GetNextPlayer_TheFirstPlayer()
        {
            TicTacTeo ttt = new TicTacTeo();

            Assert.Equal('X', ttt.NextPlayer());
        }