예제 #1
0
        public void MoveAPiece_PieceTriesToGetOutOfBoard_ReturnsFalse(string startingPosition, string finalPosition)
        {
            IChessBoard chessBoard   = new StandardChessBoard(new TestingChessPieceFactory());
            bool        escapeResult = chessBoard.MoveAPiece(startingPosition, finalPosition);

            Assert.False(escapeResult);
        }
예제 #2
0
        public void MoveAPiece_PieceAttacksOtherPiece_ReturnsTrueRemovesOnePiece(string startingPosition, string finalPosition)
        {
            IChessBoard chessBoard             = new StandardChessBoard(new TestingChessPieceFactory());
            int         startingAmountOfPieces = chessBoard.ChessPiecesOnBoard.Count;

            var  hasMoveBeenMade     = chessBoard.MoveAPiece(startingPosition, finalPosition);
            var  finalAmountOfPieces = chessBoard.ChessPiecesOnBoard.Count;
            bool wasOnePieceTaken    = startingAmountOfPieces - finalAmountOfPieces == 1;

            Assert.True(hasMoveBeenMade);
            Assert.True(wasOnePieceTaken);
        }