コード例 #1
0
        public void TestBombagPowerUp()
        {
            var block   = new GameBlock(1, 1);
            var player  = new PlayerEntity();
            var powerup = new BombBagPowerUpEntity();

            player.BombBag    = 1;
            player.BombRadius = 1;

            block.SetEntity(player);
            block.SetPowerUpEntity(powerup);
            block.ApplyPowerUp();

            Assert.AreEqual(2, player.BombBag, "Expected player bombag to increase after power up was applied");
        }
コード例 #2
0
        public void TestBombagPowerRadius()
        {
            var block   = new GameBlock(1, 1);
            var player  = new PlayerEntity();
            var powerup = new BombRaduisPowerUpEntity();

            player.BombBag    = 1;
            player.BombRadius = 2;

            block.SetEntity(player);
            block.SetPowerUpEntity(powerup);
            block.ApplyPowerUp();

            Assert.AreEqual(4, player.BombRadius, "Expected player bom radius to be increased after power up");
        }
コード例 #3
0
        public void TestPowerUpMapSymbols()
        {
            var block = CreateGameBlock();

            var powerUp = new BombBagPowerUpEntity();
            var wall    = new DestructibleWallEntity();

            block.SetPowerUpEntity(powerUp);
            block.SetEntity(wall);

            block.ExplodingBombs.Add(new BombEntity());

            Assert.AreEqual('*', block.GetMapSymbol(), "Exploding character should always be first to display");
            block.ExplodingBombs.Clear();

            Assert.AreEqual(wall.GetMapSymbol(), block.GetMapSymbol(), "Entities should always be displayed before power ups");
            block.SetEntity(null);

            Assert.AreEqual(powerUp.GetMapSymbol(), block.GetMapSymbol(), "Power up should be shown when no other symbols are present");
            block.SetPowerUpEntity(null);

            Assert.AreEqual(' ', block.GetMapSymbol(), "Empty character should display when no other entities are present on the map");

            var player = new PlayerEntity();

            block.SetEntity(player);
            block.PlantBomb(2);

            block.SetPowerUpEntity(powerUp);

            var currentSymbol = block.Bomb.GetMapSymbol();

            Assert.AreEqual(currentSymbol, block.GetMapSymbol(), "The map symbol for a bomb should be shown");

            var block2 = new GameBlock(4, 4);

            block.SetEntity(null);
            block2.SetEntity(player);

            Assert.AreNotEqual(currentSymbol, block.GetMapSymbol(), "Block symbol for bomb should change if user is moved away");
        }