public void Straight_Not_Jumper_Whites_Movement_Should_Not_Satisfy() { Board board = Board.CreateAndSetup(); JumperMovementSpecification jumperMovementSpecification = JumperMovementSpecification.Create(board); PieceMovement pieceMovement = PieceMovement.Create(board.GetSquare("A2").Piece, Position.Create("A2"), Position.Create("A4")); Assert.IsFalse(jumperMovementSpecification.IsSatisfied(pieceMovement)); }
public void Diagonal_Jumper_Movement_Should_Satisfy() { Board board = Board.CreateAndSetup(); JumperMovementSpecification jumperMovementSpecification = JumperMovementSpecification.Create(board); PieceMovement pieceMovement = PieceMovement.Create(board.GetSquare("C1").Piece, Position.Create("C1"), Position.Create("F4")); Assert.IsTrue(jumperMovementSpecification.IsSatisfied(pieceMovement)); }
public void Straight_Jumper_Blacks_Movement_Should_Satisfy() { Board board = Board.CreateAndSetup(); JumperMovementSpecification jumperMovementSpecification = JumperMovementSpecification.Create(board); PieceMovement pieceMovement = PieceMovement.Create(board.GetSquare("A8").Piece, Position.Create("A8"), Position.Create("A5")); Assert.IsTrue(jumperMovementSpecification.IsSatisfied(pieceMovement)); }
public void Diagonal_Not_Jumper_Movement_Should_Not_Satisfy() { Board board = Board.Create(); board.AddPiece(Piece.Create(PieceType.Bishop, PieceColor.White), "C1"); JumperMovementSpecification jumperMovementSpecification = JumperMovementSpecification.Create(board); PieceMovement pieceMovement = PieceMovement.Create(board.GetSquare("C1").Piece, Position.Create("C1"), Position.Create("F4")); Assert.IsFalse(jumperMovementSpecification.IsSatisfied(pieceMovement)); }
private bool CanBeMovedToRequestedPosition(PieceMovement pieceMovement) { LegalMovementSpecification legalMovementspecification = LegalMovementSpecification.Create(this); if (!legalMovementspecification.IsSatisfied(pieceMovement)) { return(false); } if (!pieceMovement.Piece.CanJump) { JumperMovementSpecification jumperMovementSpecification = JumperMovementSpecification.Create(this); if (jumperMovementSpecification.IsSatisfied(pieceMovement)) { return(false); } } return(true); }