Ejemplo n.º 1
0
        public void Whether_Board_InvokesOnPieceMoved_On_PieceMoveTo()
        {
            var board = new Board();
            var pieceMoved = false;
            board.PieceMoved += (b, m) => pieceMoved = true;
            var originalPosition = new Square(5, 4);
            var newPosition = new Square(4, 3);

            var bishop = new Bishop(originalPosition, board, PieceColor.White);
            bishop.MoveTo(newPosition);

            Assert.That(pieceMoved);
        }
Ejemplo n.º 2
0
        public void Whether_Board_InvokesPieceTaken_On_Caprute()
        {
            var board = new Board();
            var pieceTaken = false;
            var originalPosition = new Square(5, 4);
            var newPosition = new Square(4, 3);
            var bishop = new Bishop(originalPosition, board, PieceColor.White);
            var knight = new Bishop(newPosition, board, PieceColor.Black);
            knight.PieceTaken += (s) => pieceTaken = true;

            var possibleMoves = bishop.MoveTo(newPosition);

            Assert.That(board.Squares[originalPosition] == null);
            Assert.That(board.Squares[newPosition] == bishop);
            Assert.That(pieceTaken);
        }
Ejemplo n.º 3
0
        public void Whether_Board_UpdatesPositionOnBoard_On_MoveTo()
        {
            var board = new Board();
            var originalPosition = new Square(5, 4);
            var newPosition = new Square(4, 3);
            var bishop = new Bishop(originalPosition, board, PieceColor.White);

            var possibleMoves = bishop.MoveTo(newPosition);

            Assert.That(board.Squares[originalPosition] == null);
            Assert.That(board.Squares[newPosition] == bishop);
        }