public void CountPieceChancesToBeCaptured_ThereIsNoEnemyPieceAround_Zero() { var target = new CheckersBoard(8); foreach (var p in target.PlayerOnePieces) { Assert.AreEqual(0, target.CountPieceChancesToBeCaptured(p)); } foreach (var p in target.PlayerTwoPieces) { Assert.AreEqual(0, target.CountPieceChancesToBeCaptured(p)); } }
public void CountPieceChancesToBeCaptured_CanAndCannotCapture_CapturedCount() { var target = new CheckersBoard(8); var piece = target.GetSquare(1, 2).CurrentPiece; Assert.IsTrue(target.MovePiece(new CheckersMove(piece, target.GetSquare(2, 3)))); Assert.AreEqual(0, target.CountPieceChancesToBeCaptured(piece)); Assert.IsTrue(target.MovePiece(new CheckersMove(piece, target.GetSquare(3, 4)))); Assert.AreEqual(2, target.CountPieceChancesToBeCaptured(piece)); var enemyPiece = target.GetSquare(4, 5).CurrentPiece; Assert.AreEqual(0, target.CountPieceChancesToBeCaptured(enemyPiece)); Assert.IsFalse(target.MovePiece(new CheckersMove(piece, target.GetSquare(4, 5)))); Assert.AreEqual(2, target.CountPieceChancesToBeCaptured(piece)); }
public void CountPieceChancesToBeCaptured_Null_Exception() { var target = new CheckersBoard(8); ExceptionAssert.IsThrowing(new ArgumentNullException("piece"), () => { target.CountPieceChancesToBeCaptured(null); }); }