FlyingPenguinTests ClassDelta Engine Documentation
Inheritance Hierarchy

System Object
  DeltaEngine.Platforms TestWithMocksOrVisually
    CreepyTowers.Tests TestWithCreepyTowersMockContentLoaderOrVisually
      CreepyTowers.Tests CreepyTowersGameForTests
        CreepyTowers.Tests.Avatars FlyingPenguinTests

Namespace: CreepyTowers.Tests.Avatars
Assembly: CreepyTowers.Tests (in CreepyTowers.Tests.dll) Version: 1.1.1.0 (1.1.1)
Syntax

public class FlyingPenguinTests : CreepyTowersGameForTests

The FlyingPenguinTests type exposes the following members.

Constructors

  NameDescription
Public methodFlyingPenguinTests
Initializes a new instance of the FlyingPenguinTests class
Top
Methods

  NameDescription
Protected methodAdvanceTimeAndUpdateEntities (Inherited from TestWithMocksOrVisually.)
Public methodDispose (Inherited from CreepyTowersGameForTests.)
Public methodInitialize (Overrides CreepyTowersGameForTests Initialize .)
Public methodInitializeCreepyTowersMockContentLoader (Inherited from TestWithCreepyTowersMockContentLoaderOrVisually.)
Public methodInitializeResolver (Inherited from TestWithMocksOrVisually.)
Public methodPerformBigFireworkAttack
Public methodPerformCarpetBombingAttack
Protected methodRegisterMock T  (Inherited from TestWithMocksOrVisually.)
Protected methodResolve T  (Inherited from TestWithMocksOrVisually.)
Protected methodRunAfterFirstFrame (Inherited from TestWithMocksOrVisually.)
Public methodRunTestAndDisposeResolverWhenDone (Inherited from TestWithMocksOrVisually.)
Public methodWithFlyingPenguinTowerHasFasterAttacks
Public methodWithoutFlyingPenguinTowerHasDefaultAttackFrequency
Top
Fields

  NameDescription
Protected fieldgame (Inherited from CreepyTowersGameForTests.)
Top
Properties

  NameDescription
Protected propertyIsMockResolver (Inherited from TestWithMocksOrVisually.)
Top
Examples

[Test]
public void WithoutFlyingPenguinTowerHasDefaultAttackFrequency()
{
    player.UnlockAvatar(CreepyTowers.Content.Avatars.Dragon);
    player.ChangeAvatar(CreepyTowers.Content.Avatars.Dragon);
    var tower = new Tower(TowerType.Fire, Vector3D.Zero);
    var towerProperties = ContentLoader.Load<TowerPropertiesXml>(Xml.TowerProperties.ToString());
    var defaultAttackFrequency = towerProperties.Get(TowerType.Fire).AttackFrequency;
    Assert.AreEqual(defaultAttackFrequency, tower.GetStatValue("AttackFrequency"));
}
[Test]
public void WithFlyingPenguinTowerHasFasterAttacks()
{
    var tower = new Tower(TowerType.Fire, Vector3D.Zero);
    var towerProperties = ContentLoader.Load<TowerPropertiesXml>(Xml.TowerProperties.ToString());
    var defaultAttackFrequency = towerProperties.Get(TowerType.Fire).AttackFrequency;
    Assert.AreEqual(defaultAttackFrequency * 1.3333f, tower.GetStatValue("AttackFrequency"));
}
[Test]
public void PerformBigFireworkAttack()
{
    var creepOutsideRange = new Creep(CreepType.Paper, new Vector2D(4, 4));
    var creepInsideRange = new Creep(CreepType.Paper, new Vector2D(2, 2));
    player.Avatar.PerformAttack(AvatarAttack.PenguinBigFirework, new Vector2D(1, 1));
    Assert.AreEqual(1, creepOutsideRange.GetStatPercentage("Hp"));
    Assert.Less(creepInsideRange.GetStatPercentage("Hp"), 1);
}
[Test]
public void PerformCarpetBombingAttack()
{
    new Level(new Size(5, 5));
    Randomizer.Use(new FixedRandom(new[] { 0.1f, 0.2f, 0.1f, 0.2f, 0.1f, 0.2f, 0.3f }));
    var missedCreep = new Creep(CreepType.Paper, new Vector2D(4, 4));
    var hitCreep = new Creep(CreepType.Paper, new Vector2D(0, 1));
    player.Avatar.PerformAttack(AvatarAttack.PenguinCarpetBombing, Vector2D.Unused);
    Assert.AreEqual(1, missedCreep.GetStatPercentage("Hp"));
    Assert.Less(hitCreep.GetStatPercentage("Hp"), 1);
}
See Also