コード例 #1
0
 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();
 }
コード例 #2
0
 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();
 }
コード例 #3
0
 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();
 }
コード例 #4
0
 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();
 }
コード例 #5
0
 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();
 }
コード例 #6
0
 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();
 }
コード例 #7
0
 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();
 }
コード例 #8
0
 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();
 }