Пример #1
0
        public void Whether_Queen_CantMoveToIncorrectSquare_On_CanMoveTo()
        {
            var board = new Board();
            var queen = new Queen(new Square(4, 4), board, PieceColor.White);

            Assert.That(queen.CanMoveTo(new Square(6, 3)), Is.False);
        }
Пример #2
0
        public void Whether_Queen_CanMoveToCornerSquares_On_CanMoveTo(int x, int y)
        {
            var board = new Board();
            var queen = new Queen(new Square(3, 3), board, PieceColor.White);

            Assert.That(queen.CanMoveTo(new Square(x, y)), Is.True);
        }
Пример #3
0
        public void Whether_Queen_CanGrabOpponentsPiece_On_CanMoveTo()
        {
            var board  = new Board();
            var queen  = new Queen(new Square(4, 4), board, PieceColor.White);
            var knight = new Knight(new Square(5, 5), board, PieceColor.Black);

            Assert.That(queen.CanMoveTo(new Square(5, 5)), Is.True);
        }
Пример #4
0
        public void Whether_Queen_CantJumpOverAnotherPiece_On_CanMoveTo(PieceColor pieceColor)
        {
            var board  = new Board();
            var queen  = new Queen(new Square(4, 4), board, PieceColor.White);
            var knight = new Knight(new Square(5, 5), board, pieceColor);

            Assert.That(queen.CanMoveTo(new Square(6, 6)), Is.False);
        }
Пример #5
0
        public void Whether_Queen_CantMoveOutsideTheBoard_On_CanMoveTo()
        {
            var board = new Board();
            var queen = new Queen(new Square(1, 1), board, PieceColor.White);

            Assert.That(queen.PossibleMoves().Count() == 21);
            Assert.That(queen.CanMoveTo(new Square(-1, -1)), Is.False);
        }
Пример #6
0
        public void Whether_Queen_CantMoveToOccupiedSquare_On_CanMoveTo()
        {
            var board         = new Board();
            var queen         = new Queen(new Square(4, 4), board, PieceColor.White);
            var anotherKnight = new Knight(new Square(6, 6), board, PieceColor.White);

            Assert.That(queen.CanMoveTo(new Square(6, 6)), Is.False);
        }
Пример #7
0
        public void Whether_Queen_CanMoveToPossibleSquare_On_CanMoveTo(int offsetX, int offsetY)
        {
            var board = new Board();
            var queen = new Queen(new Square(4, 4), board, PieceColor.White);

            Assert.That(queen.CanMoveTo(
                            new Square(queen.Position.XPosition + offsetX,
                                       queen.Position.YPosition + offsetY)));
        }
Пример #8
0
        public void CanMoveTo_should_return_false_when_target_square_is_not_valid()
        {
            // Arrange
            const string currentSquare = "f1";
            const string targetSquare  = "d8";
            ChessmenBase queen         = new Queen(Color.Black, currentSquare);

            // Act
            var result = queen.CanMoveTo(targetSquare);

            // Assert
            Assert.That(result, Is.False);
        }