Beispiel #1
0
        public void TestGetPasses()
        {
            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];
            var pass       = new Pass(null, null, null, null, null);

            bonusTable[2, 2] = pass;
            board.Fill(boardTable, bonusTable);

            Assert.True(board.GetPasses().Count() == 1);
            Assert.AreSame(board.GetPasses().GetEnumerator().Current, pass);
        }
Beispiel #2
0
        public void TestInvertBoard()
        {
            int width  = 3;
            int height = 2;

            var board      = new SingleBoardStorage(width, height, null);
            var bonusTable = new BoardStorageItem[width + 1, height + 1];
            var boardTable = new BoardStorageItem[width + 1, height + 1];
            var pass       = new Pass(null, null, null, null, null);
            var item       = new ArmyStorageItem(null, null);

            bonusTable[2, 1] = pass;
            boardTable[3, 2] = item;

            board.Fill(boardTable, bonusTable);
            board.InvertBoard();

            Assert.AreSame(board.GetItem(3, 2), null);
            Assert.AreSame(board.GetBonusItem(2, 1), null);
            Assert.AreSame(board.GetItem(2, 2), item);
            Assert.AreSame(board.GetBonusItem(1, 1), pass);
        }
Beispiel #3
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);
        }