private string GetPartialSAN() { if (MovingPiece.Kind == ChessPieceKind.Pawn) { if (CapturedPiece == ChessPieceKind.None) { return(To.AlgebraicNotation); } else { if ((MoveKind & ChessMoveType.EP_Capture) == ChessMoveType.EP_Capture) { return($"{From.File}x{To.AlgebraicNotation} e.p."); } return($"{From.File}x{To.AlgebraicNotation}"); } } else { if (MoveKind == ChessMoveType.KSide_Castle) { return("O-O"); } if (MoveKind == ChessMoveType.QSide_Castle) { return("O-O-O"); } if ((MoveKind & ChessMoveType.Capture) == ChessMoveType.Capture) { return($"{FEN.ChessPieceToFEN(MovingPiece).ToUpper()}x{To.AlgebraicNotation}"); } return($"{FEN.ChessPieceToFEN(MovingPiece).ToUpper()}{To.AlgebraicNotation}"); } }
public void ChessPieceToFEN_Should_ThrowArgumentNullException_WhenPieceIsNull() { SUT.ChessPieceToFEN(null); }
public void ChessPieceToFEN_Should_ReturnCorrectFENPiece(ChessPieceKind pieceKind, ChessColor pieceColor, string expectedFEN) { // Assert Assert.AreEqual(expectedFEN, SUT.ChessPieceToFEN(new ChessPiece(pieceKind, pieceColor))); }