public void Pawn_Move_Diagonal_Left_Encounters_Pawn_With_SameColor_DoesNotUpdateCoordinates() { blackPawn1.TryMoveForward(1); Assert.AreEqual(new Position(5, 3), blackPawn1.CurrentPosition); Assert.IsFalse(chessBoard.Cells[5, 3].IsEmpty); Assert.AreEqual(new Position(6, 4), blackPawn2.CurrentPosition); Assert.IsFalse(chessBoard.Cells[6, 4].IsEmpty); Assert.IsFalse(blackPawn2.TryMoveDiagonalLeftForward(1)); Assert.AreEqual(new Position(5, 3), blackPawn1.CurrentPosition); Assert.IsFalse(chessBoard.Cells[5, 3].IsEmpty); Assert.AreEqual(new Position(6, 4), blackPawn2.CurrentPosition); Assert.IsFalse(chessBoard.Cells[6, 4].IsEmpty); }
public void Pawn_Move_Diagonal_Left_Throws_Exception_If_Already_Captured() { int i = 1; while (i < 5) { blackPawn2.TryMoveForward(1); i++; } Assert.IsTrue(blackPawn2.TryMoveDiagonalLeftForward(1)); Assert.IsTrue(whitePawn1.IsCaptured); Assert.Throws <InvalidOperationException>(() => whitePawn1.TryMoveDiagonalLeftForward(1)); }
public void Pawn_Move_Diagonal_Left_Throws_Exception_For_InvalidSteps(int steps) { Assert.Throws <InvalidOperationException>(() => blackPawn1.TryMoveDiagonalLeftForward(steps)); }