Exemple #1
0
        public void TestMockedChessOverrides()
        {
            var chess = new MockedChess();

            Assert.Empty(chess.AllMoves(true));
            Assert.Empty(chess.AllMoves(false));

            Assert.Empty(chess.AvailableMoves(true));
            Assert.Empty(chess.AvailableMoves(false));

            Assert.False(chess.Process(
                             new Move(
                                 new Square(Files.a, Ranks.one),
                                 new Square(Files.a, Ranks.one),
                                 MoveType.Normal),
                             out IPiece piece));
            Assert.Null(piece);
        }
Exemple #2
0
        public void TestInvalidMove(
            bool withPiece
            )
        {
            IChess chess = new MockedChess();

            var invalid = new Move(
                new Square(Files.a, Ranks.one),
                new Square(Files.b, Ranks.two),
                MoveType.Normal);

            if (withPiece)
            {
                ((Chess)chess).PlaceAt(invalid.FromSquare, new MockedPiece(true));
            }

            Assert.False(chess.Process(invalid, out IPiece p));
        }