Exemple #1
0
        public void Move_Black_Onto_Unoccupied_Square_Allowed()
        {
            var board = SetupBoardWithUnoccupiedSquare();

            var mover = Substitute.For <IChessPiece>();

            mover.Color.Returns(PieceColor.Black);

            IRule rule = new EndpointSquareOccupiedRule();

            Move move = new Move(mover, 0, 0, 1, 1);

            Assert.That(rule.IsMoveValid(board, move), Is.True);
        }
Exemple #2
0
        public void Move_White_Onto_Square_Occupied_By_White_Prohibited()
        {
            var board = SetupBoardWithOccupiedSquare(PieceColor.White);

            var mover = Substitute.For <IChessPiece>();

            mover.Color.Returns(PieceColor.White);

            IRule rule = new EndpointSquareOccupiedRule();

            Move move = new Move(mover, 0, 0, 1, 1);

            Assert.That(rule.IsMoveValid(board, move), Is.False);
        }