public void TestPopulateGrid()
        {
            Grid _grid = new Grid ();
            _grid.GridDraw ();

            Assert.IsTrue ( _grid.Squares[4].IsAt ( SwinGame.PointAt ( 230, 230 )) );
            Assert.IsFalse ( _grid.Squares[4].IsAt ( SwinGame.PointAt ( 200, 100 )) );

            Assert.IsTrue ( _grid.Squares[4].SelectedO == false );
            Assert.IsTrue ( _grid.Squares[4].SelectedX == false );
        }
예제 #2
0
        public void TestGridSelectO()
        {
            Grid _grid = new Grid ();
            _grid.GridDraw ();

            Assert.IsFalse ( _grid.Squares[4].SelectedO == true );

            _grid.SelectSquareO ( SwinGame.PointAt ( 230, 230 ));

            Assert.IsTrue ( _grid.Squares[4].SelectedO == true );
        }
        public void TestWinGrid()
        {
            Grid _grid = new Grid ();
            _grid.GridDraw ();

            Assert.IsFalse ( _grid.CheckWinState () );

            _grid.SelectSquareO ( SwinGame.PointAt ( 230, 230 ));
            Assert.IsTrue ( _grid.Squares[4].SelectedO == true );

            _grid.Squares[1].SelectedO = true;
            _grid.Squares[7].SelectedO = true;

            Assert.IsTrue ( _grid.CheckWinState () );
        }
        public void TestFullGrid()
        {
            Grid _grid = new Grid ();
            _grid.GridDraw ();

            Assert.IsFalse ( _grid.CheckFull () );

            _grid.Squares[0].SelectedX = true;
            _grid.Squares[1].SelectedX = true;
            _grid.Squares[2].SelectedO = true;
            _grid.Squares[3].SelectedO = true;
            _grid.Squares[4].SelectedX = true;
            _grid.Squares[5].SelectedX = true;
            _grid.Squares[6].SelectedX = true;
            _grid.Squares[7].SelectedO = true;
            _grid.Squares[8].SelectedO = true;

            Assert.IsTrue ( _grid.CheckFull () );
        }
예제 #5
0
        public void TestGridReset()
        {
            Grid _grid = new Grid ();
            _grid.GridDraw ();

            _grid.Squares[0].SelectedX = true;
            _grid.Squares[1].SelectedX = true;
            _grid.Squares[2].SelectedO = true;
            _grid.Squares[3].SelectedO = true;
            _grid.Squares[4].SelectedX = true;
            _grid.Squares[5].SelectedX = true;
            _grid.Squares[6].SelectedX = true;
            _grid.Squares[7].SelectedO = true;
            _grid.Squares[8].SelectedO = true;

            Assert.IsTrue ( _grid.Squares[0].SelectedX == true );
            Assert.IsTrue ( _grid.Squares[1].SelectedX == true );
            Assert.IsTrue ( _grid.Squares[2].SelectedO == true );
            Assert.IsTrue ( _grid.Squares[3].SelectedO == true );
            Assert.IsTrue ( _grid.Squares[4].SelectedX == true );
            Assert.IsTrue ( _grid.Squares[5].SelectedX == true );
            Assert.IsTrue ( _grid.Squares[6].SelectedX == true );
            Assert.IsTrue ( _grid.Squares[7].SelectedO == true );
            Assert.IsTrue ( _grid.Squares[8].SelectedO == true );

            _grid.Reset ();

            Assert.IsTrue ( _grid.Squares[0].SelectedX == false );
            Assert.IsTrue ( _grid.Squares[1].SelectedX == false );
            Assert.IsTrue ( _grid.Squares[2].SelectedO == false );
            Assert.IsTrue ( _grid.Squares[3].SelectedO == false );
            Assert.IsTrue ( _grid.Squares[4].SelectedX == false );
            Assert.IsTrue ( _grid.Squares[5].SelectedX == false );
            Assert.IsTrue ( _grid.Squares[6].SelectedX == false );
            Assert.IsTrue ( _grid.Squares[7].SelectedO == false );
            Assert.IsTrue ( _grid.Squares[8].SelectedO == false );
        }
 /// <summary>
 /// Initializes the GameController.
 /// </summary>
 static GameController()
 {
     _state.Push(GameState.Quitting);
     _state.Push(GameState.InputState);
     _grid = new Grid ();
 }