Example #1
0
        public void Should_return_false_when_no_piece_in_passing_location()
        {
            _boardState.Remove("B6".ToBoardLocation());
            BoardLocation to   = "B7".ToBoardLocation();
            var           move = new BoardMove("A6".ToBoardLocation(), to, (int)DefaultActions.TakeOnly);

            Assert.False(_validator.ValidateMove(move, _boardState));
        }
Example #2
0
        /// <summary>
        ///     Creates the state of the enemy board.
        /// </summary>
        /// <param name="boardState"></param>
        /// <param name="owningPlayerBoardState"></param>
        /// <returns></returns>
        protected IBoardState CreateEnemyBoardState(IBoardState boardState, IBoardState owningPlayerBoardState)
        {
            IBoardState state = ModelLocator.BoardState;

            state.Add(boardState);
            state.Remove(owningPlayerBoardState);

            return(state);
        }
Example #3
0
        public void Should_RemovePositions()
        {
            // setup
            IBoardState         state    = ModelLocator.BoardState;
            const ChessPosition POSITION = ChessPosition.A1;

            state.Add(POSITION);

            // execute
            state.Remove(POSITION);

            // verify
            Assert.IsFalse(state.Contains(POSITION));
        }
Example #4
0
        public void Should_RemoveAllPositionsFromBoardstate()
        {
            // setup
            IBoardState state     = ModelLocator.BoardState;
            var         positions = new[] { ChessPosition.A2, ChessPosition.A1, ChessPosition.A4, ChessPosition.E3 };

            foreach (var position in positions)
            {
                state.Add(position);
            }

            IBoardState state2 = ModelLocator.BoardState;

            state2.Add(state);

            // execute
            state.Remove(state2);

            // verify
            Assert.IsTrue(positions.All(p => !state.Contains(p)));
        }