Ejemplo n.º 1
0
        public void FiguresDontReplaceAllies()
        {
            var game       = new Game();
            var blackKing  = new King(Color.Black);
            var blackQueen = new Queen(Color.Black);

            game.Board[3, 3] = blackKing;
            game.Board[4, 4] = blackQueen;
            game.SelectedFigureCoordinates = Tuple.Create(3, 3);
            Assert.IsFalse(blackKing.CorrectMove(game.SelectedFigureCoordinates, Tuple.Create(4, 4)));
        }
Ejemplo n.º 2
0
        public void KingMovesCorrectly()
        {
            var game      = new Game();
            var blackKing = new King(Color.Black);

            game.Board[3, 3] = blackKing;
            game.SelectedFigureCoordinates = Tuple.Create(3, 3);
            for (int i = 0; i < game.Board.GetLength(0); i++)
            {
                for (int j = 0; j < game.Board.GetLength(1); j++)
                {
                    if (!(i == 3 && j == 3) &&
                        (1 < i && i < 5) &&
                        (1 < j && j < 5))
                    {
                        Assert.IsTrue(blackKing.CorrectMove(game.SelectedFigureCoordinates, Tuple.Create(i, j)));
                    }
                    else
                    {
                        Assert.IsFalse(blackKing.CorrectMove(game.SelectedFigureCoordinates, Tuple.Create(i, j)));
                    }
                }
            }
        }