Ejemplo n.º 1
0
        public void TestFindPlayerArmies()
        {
            var firstPlayerType  = PlayerType.FIRST;
            var secondPlayerType = PlayerType.SECOND;

            int size       = 3;
            var board      = new SingleBoardStorage(size, size, null);
            var bonusTable = new BoardStorageItem[size + 1, size + 1];
            var boardTable = new BoardStorageItem[size + 1, size + 1];

            boardTable[2, 2] = new ArmyStorageItem(new UserArmy(firstPlayerType, null), null);
            boardTable[1, 2] = new ArmyStorageItem(new UserArmy(firstPlayerType, null), null);

            board.Fill(boardTable, bonusTable);

            Assert.True(board.ContainsPlayerArmies(firstPlayerType));
            Assert.False(board.ContainsPlayerArmies(secondPlayerType));

            var armies = board.FindPlayerArmies(firstPlayerType);

            Assert.True(armies.Contains(board.GetCellByPosition(new IntVector2(1, 2))));
            Assert.True(armies.Contains(board.GetCellByPosition(new IntVector2(2, 2))));
            Assert.True(armies.Count == 2);
        }
Ejemplo n.º 2
0
        public void TestIndexByCell()
        {
            var board = new SingleBoardStorage(2, 3, null);

            for (int i = 1; i <= board.GetBoardWidth(); i++)
            {
                for (int j = 1; j <= board.GetBoardHeight(); j++)
                {
                    var testedPosition = new IntVector2(i, j);
                    var cell           = board.GetCellByPosition(testedPosition);
                    var position       = board.GetPositionOnBoard(cell);

                    Assert.True(position.Equals(testedPosition));
                }
            }
        }