Ejemplo n.º 1
0
 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}");
     }
 }
Ejemplo n.º 2
0
 public void ChessPieceToFEN_Should_ThrowArgumentNullException_WhenPieceIsNull()
 {
     SUT.ChessPieceToFEN(null);
 }
Ejemplo n.º 3
0
 public void ChessPieceToFEN_Should_ReturnCorrectFENPiece(ChessPieceKind pieceKind, ChessColor pieceColor, string expectedFEN)
 {
     //	Assert
     Assert.AreEqual(expectedFEN, SUT.ChessPieceToFEN(new ChessPiece(pieceKind, pieceColor)));
 }