Пример #1
0
        public void TestBoardAdding()
        {
            IBoardBuilder boardBuilder = new BoardBuilder();

            IBoard board = boardBuilder.Columns(8).Rows(8).AddPiece(new Piece(PieceType.KING, new BoardPosition(0, 0), null)).Build();

            Assert.False(board.Add(new Piece(PieceType.ROOK, new BoardPosition(0, 0), null)));
            Assert.True(board.Add(new Piece(PieceType.ROOK, new BoardPosition(1, 0), null)));
        }
Пример #2
0
        public void Should_ReturnTrueForOccupiedLocation()
        {
            // setup
            IBoard board = ModelLocator.Board;
            const ChessPosition POSITION = ChessPosition.A4;

            board.Add(POSITION);

            // execute
            bool isOccupied = board.IsPositionOccupied(POSITION);

            // verify
            Assert.IsTrue(isOccupied);
        }
Пример #3
0
        public void Should_AddData_ToBoard()
        {
            //Arrange
            int    key   = 1;
            string value = "X";

            //Act
            board.Add(key, value);
            var result = board.ContainsKey(key);

            //Assert
            Assert.True(result);
        }
Пример #4
0
        public void Should_AddPieceAtLocation()
        {
            // setup
            IBoard board = ModelLocator.Board;
            const ChessPosition POSITION = ChessPosition.A4;

            // execute

            // add a position that is not in the starting positions in case concrete adds starting positions
            // by default
            board.Add(POSITION);

            // verify
            Assert.IsTrue(board.State.IsPositionOccupied(POSITION));
        }
Пример #5
0
        public IBoardBuilder BuildGoSpace()
        {
            IVisitableSpace goSpace = spaceFactory.CreateGoSpace(builtBoard);

            builtBoard.Add(goSpace);
            builtBoard.GoSpace = goSpace;
            return(this);
        }