Beispiel #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);
        }
Beispiel #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);
        }
Beispiel #3
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);
        }
Beispiel #4
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);
        }
Beispiel #5
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);
        }
Beispiel #6
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);
        }
Beispiel #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)));
        }
Beispiel #8
0
        public void Whether_Queen_ReturnsCorrectMoves_On_PossibleMoves()
        {
            var board = new Board();
            var queen = new Queen(new Square(4, 4), board, PieceColor.White);

            var possibleMoves = queen.PossibleMoves();

            Assert.That(possibleMoves != null);
            Assert.That(possibleMoves.Count() == 27);
        }