public void Whether_King_CantMoveToIncorrectSquare_On_CanMoveTo() { var board = new Board(); var king = new King(new Square(4, 4), board, PieceColor.White); Assert.That(king.CanMoveTo(new Square(6, 6)), Is.False); }
public void Whether_King_CantEscapeFromRookOnTheSameFile_OnCanMoveTo() { var board = new Board(); var king = new King(new Square(4, 4), board, PieceColor.White); var bishop = new Rook(new Square(5, 4), board, PieceColor.Black); Assert.That(king.CanMoveTo(new Square(3, 4)), Is.False); }
public void Whether_King_CantMoveToBeatenPawnSquare_On_CanMoveTo() { var board = new Board(); var king = new King(new Square(4, 4), board, PieceColor.White); var bishop = new Pawn(new Square(5, 4), board, PieceColor.Black); Assert.That(king.CanMoveTo(new Square(4, 3)), Is.False); }
public void Whether_King_CantMoveOutsideTheBoard_On_CanMoveTo() { var board = new Board(); var king = new King(new Square(1, 1), board, PieceColor.White); Assert.That(king.PossibleMoves().Count() == 3); Assert.That(king.CanMoveTo(new Square(-1, -1)), Is.False); }
public void Whether_King_CantMoveToOccupiedSquare_On_CanMoveTo() { var board = new Board(); var king = new King(new Square(4, 4), board, PieceColor.White); var anotherKnight = new Knight(new Square(5, 5), board, PieceColor.White); Assert.That(king.CanMoveTo(new Square(5, 5)), Is.False); }
public void Whether_King_CantEscapeFromBishopOnTheSameDiagonal_OnCanMoveTo() { var board = new Board(); var king = new King(new Square(4, 4), board, PieceColor.White); var bishop = new Bishop(new Square(5, 5), board, PieceColor.Black); Assert.That(king.CanMoveTo(new Square(3, 3)), Is.False); }
public void Whether_King_CanMoveToPossibleSquare_On_CanMoveTo(int offsetX, int offsetY) { var board = new Board(); var king = new King(new Square(4, 4), board, PieceColor.White); Assert.That(king.CanMoveTo( new Square(king.Position.XPosition + offsetX, king.Position.YPosition + offsetY))); }
public void CanMoveTo_should_return_false_when_target_square_is_not_valid() { // Arrange const string currentSquare = "f1"; const string targetSquare = "d8"; ChessmenBase king = new King(Color.Black, currentSquare); // Act var result = king.CanMoveTo(targetSquare); // Assert Assert.That(result, Is.False); }