Beispiel #1
0
        public void PawnCrossMoveForbiddenTest()
        {
            var board        = BoardGenerator.GetInitialBoard();
            var fromPosition = new PiecePosition('A', 7);
            var toPosition   = new PiecePosition('B', 6);

            Assert.IsFalse(board.Move(_blackPlayer, fromPosition, toPosition));
        }
Beispiel #2
0
        public void PawnStraightMoveToTakePieceForbiddenTest()
        {
            var board        = BoardGenerator.GetWithWhiteKnightInB6();
            var fromPosition = new PiecePosition('B', 7);
            var toPosition   = new PiecePosition('B', 6);

            Assert.IsFalse(board.Move(_blackPlayer, fromPosition, toPosition));
        }
Beispiel #3
0
        public void KnightImpossibleMoves()
        {
            var board     = BoardGenerator.GetInitialBoard();
            var position1 = new PiecePosition('B', 1);
            var position2 = new PiecePosition('B', 3);
            var position3 = new PiecePosition('A', 2);
            var position4 = new PiecePosition('D', 5);

            Assert.IsFalse(board.Move(_whitePlayer, position1, position2));
            Assert.IsFalse(board.Move(_whitePlayer, position1, position3));
            Assert.IsFalse(board.Move(_whitePlayer, position1, position4));
        }
Beispiel #4
0
        public void KnightMoves()
        {
            var board     = BoardGenerator.GetInitialBoard();
            var position1 = new PiecePosition('B', 1);
            var position2 = new PiecePosition('C', 3);
            var position3 = new PiecePosition('B', 5);
            var position4 = new PiecePosition('C', 7);

            Assert.IsTrue(board.Move(_whitePlayer, position1, position2));
            Assert.IsTrue(board.Move(_whitePlayer, position2, position3));
            Assert.IsTrue(board.Move(_whitePlayer, position3, position4));
        }
Beispiel #5
0
        public void PawnCrossMoveToTakePieceAuthorizedTest()
        {
            var board        = BoardGenerator.GetWithWhiteKnightInB6();
            var fromPosition = new PiecePosition('A', 7);
            var toPosition   = new PiecePosition('B', 6);

            Assert.IsTrue(board.Move(_blackPlayer, fromPosition, toPosition));

            board        = BoardGenerator.GetWithWhiteKnightInB6();
            fromPosition = new PiecePosition('C', 7);
            toPosition   = new PiecePosition('B', 6);
            Assert.IsTrue(board.Move(_blackPlayer, fromPosition, toPosition));
        }
Beispiel #6
0
        public void RookImpossibleMoves()
        {
            var board = BoardGenerator.GetInitialBoard();

            board.Move(_whitePlayer, new PiecePosition('A', 2), new PiecePosition('A', 4));

            var position1 = new PiecePosition('A', 1);
            var position2 = new PiecePosition('A', 4);
            var position3 = new PiecePosition('A', 3);
            var position4 = new PiecePosition('H', 4);

            Assert.IsFalse(board.Move(_whitePlayer, position1, position2));
            Assert.IsTrue(board.Move(_whitePlayer, position1, position3));
            Assert.IsFalse(board.Move(_whitePlayer, position3, position4));
        }
Beispiel #7
0
        public void PawnFirstMove2CellsTest()
        {
            var board = BoardGenerator.GetInitialBoard();

            for (char col = 'A'; col <= 'H'; col++)
            {
                var fromPosition = new PiecePosition(col, 2);
                var toPosition   = new PiecePosition(col, 4);
                Assert.IsTrue(board.Move(_whitePlayer, fromPosition, toPosition));
                Assert.IsFalse(board.Move(_blackPlayer, fromPosition, toPosition));
            }

            for (char col = 'A'; col <= 'H'; col++)
            {
                var fromPosition = new PiecePosition(col, 7);
                var toPosition   = new PiecePosition(col, 5);
                Assert.IsFalse(board.Move(_whitePlayer, fromPosition, toPosition));
                Assert.IsTrue(board.Move(_blackPlayer, fromPosition, toPosition));
            }
        }
Beispiel #8
0
        public void PawnFirstMoves1CellTest()
        {
            var board = BoardGenerator.GetInitialBoard();

            for (char col = 'A'; col <= 'H'; col++)
            {
                var position1 = new PiecePosition(col, 2);
                var position2 = new PiecePosition(col, 3);
                var position3 = new PiecePosition(col, 4);
                Assert.IsTrue(board.Move(_whitePlayer, position1, position2));
                Assert.IsFalse(board.Move(_blackPlayer, position1, position2));
                Assert.IsTrue(board.Move(_whitePlayer, position2, position3));
            }

            for (char col = 'A'; col <= 'H'; col++)
            {
                var position1 = new PiecePosition(col, 7);
                var position2 = new PiecePosition(col, 6);
                var position3 = new PiecePosition(col, 4);
                Assert.IsFalse(board.Move(_whitePlayer, position1, position2));
                Assert.IsTrue(board.Move(_blackPlayer, position1, position2));
                Assert.IsFalse(board.Move(_blackPlayer, position2, position3));
            }
        }