示例#1
0
        public void ShiftTile()
        {
            int boardWidth = 2, boardHeight = 2;

            var board = new Chessboard(new MockRenderer());

            board.Setup(boardWidth, boardHeight);

            board.SetActiveTile(0, 0);
            Assert.True(board.GetActiveTile().GetId() == "A1");

            board.ShiftTileRight();
            Assert.True(board.GetActiveTile().GetId() == "B1");

            board.ShiftTileUp();
            Assert.True(board.GetActiveTile().GetId() == "B2");

            board.ShiftTileLeft();
            Assert.True(board.GetActiveTile().GetId() == "A2");

            board.ShiftTileDown();
            Assert.True(board.GetActiveTile().GetId() == "A1");
        }
示例#2
0
        public void Setup()
        {
            int boardWidth = 8, boardHeight = 8;
            var board = new Chessboard(new MockRenderer());

            board.Setup(boardWidth, boardHeight);
            var activeTile = board.GetActiveTile();
            var finishTile = board.GetFinishedTile();

            Assert.Equal(typeof(Tile), activeTile.GetType());
            Assert.Equal(0, activeTile.GetYPos());
            Assert.True(activeTile.GetXPos() >= 0 && activeTile.GetXPos() < boardWidth);

            Assert.Equal(typeof(FinishTile), finishTile.GetType());
            Assert.Equal(boardHeight - 1, finishTile.GetYPos());
            Assert.True(finishTile.GetXPos() >= 0 && finishTile.GetXPos() < boardWidth);
        }