예제 #1
0
        public void Whether_Bishop_CantMoveToIncorrectSquare_On_CanMoveTo()
        {
            var board = new Board();
            var bishop = new Bishop(new Square(4, 4), board, PieceColor.White);

            Assert.That(bishop.CanMoveTo(new Square(6, 5)), Is.False);
        }
예제 #2
0
        public void Whether_Bishop_CantMoveToOccupiedSquare_On_CanMoveTo()
        {
            var board = new Board();
            var bishop = new Bishop(new Square(4, 4), board, PieceColor.White);
            var anotherKnight = new Knight(new Square(6, 6), board, PieceColor.White);

            Assert.That(bishop.CanMoveTo(new Square(6, 6)), Is.False);
        }
예제 #3
0
        public void Whether_Bishop_CantJumpOverAnotherPiece_On_CanMoveTo(PieceColor pieceColor)
        {
            var board = new Board();
            var bishop = new Bishop(new Square(4, 4), board, PieceColor.White);
            var knight = new Knight(new Square(5, 5), board, pieceColor);

            Assert.That(bishop.CanMoveTo(new Square(6, 6)), Is.False);
        }
예제 #4
0
        public void Whether_Bishop_CantMoveOutsideTheBoard_On_CanMoveTo()
        {
            var board = new Board();
            var bishop = new Bishop(new Square(1, 1), board, PieceColor.White);

            Assert.That(bishop.PossibleMoves().Count() == 7);
            Assert.That(bishop.CanMoveTo(new Square(-1, -1)), Is.False);
        }
예제 #5
0
        public void Whether_Bishop_CanMoveToPossibleSquare_On_CanMoveTo(int offsetX, int offsetY)
        {
            var board = new Board();
            var bishop = new Bishop(new Square(4, 4), board, PieceColor.White);

            Assert.That(bishop.CanMoveTo(
                new Square(bishop.Position.XPosition + offsetX,
                           bishop.Position.YPosition + offsetY)));
        }