public void Given_a_move_from_the_same_file__should_return_false() { var source = new Position { File = File.B, }; const bool isCapture = true; var destination = new Position { File = File.B, Row = Row.Row6 }; var result = PieceType.Bishop.IsLegal(source, isCapture, destination); result.ShouldBeFalse(); }
public void Given_a_move_from_different_row_and_file__should_return_false() { var source = new Position { File = File.C, Row = Row.Row1 }; const bool isCapture = true; var destination = new Position { File = File.B, Row = Row.Row6 }; var result = PieceType.Rook.IsLegal(source, isCapture, destination); result.ShouldBeFalse(); }
public void Given_a_move_from_same_row__should_return_true() { var source = new Position { Row = Row.Row6 }; const bool isCapture = true; var destination = new Position { File = File.B, Row = Row.Row6 }; var result = PieceType.Rook.IsLegal(source, isCapture, destination); result.ShouldBeTrue(); }
public void Given_a_non_capture_from_the_same_file__should_return_true() { var source = new Position { File = null }; const bool isCapture = false; var destination = new Position { File = File.C, Row = Row.Row6 }; var result = PieceType.Pawn.IsLegal(source, isCapture, destination); result.ShouldBeTrue(); }
public void Given_a_capture_from_an_adjacent_file__should_return_true() { var source = new Position { File = File.A }; const bool isCapture = true; var destination = new Position { File = File.B, Row = Row.Row6 }; var result = PieceType.Pawn.IsLegal(source, isCapture, destination); result.ShouldBeTrue(); }
public void Given_a_move_where_the_numbers_of_rows_away_is_the_same_as_the_number_of_files_away__should_return_false() { var source = new Position { File = File.C, Row = Row.Row5 }; const bool isCapture = true; var destination = new Position { File = File.B, Row = Row.Row6 }; var result = PieceType.Knight.IsLegal(source, isCapture, destination); result.ShouldBeFalse(); }
public void Given_a_move_from_more_than_2_rows_away__should_return_false() { var source = new Position { Row = Row.Row1 }; const bool isCapture = true; var destination = new Position { File = File.B, Row = Row.Row6 }; var result = PieceType.Knight.IsLegal(source, isCapture, destination); result.ShouldBeFalse(); }
public void Given_a_move_from_a_non_adjacent_row__should_return_false() { var source = new Position { File = File.D, }; const bool isCapture = true; var destination = new Position { File = File.B, Row = Row.Row6 }; var result = PieceType.King.IsLegal(source, isCapture, destination); result.ShouldBeFalse(); }