BossTests ClassDelta Engine Documentation
Inheritance Hierarchy

System Object
  DeltaEngine.Platforms TestWithMocksOrVisually
    CreepyTowers.Tests TestWithCreepyTowersMockContentLoaderOrVisually
      CreepyTowers.Tests CreepyTowersGameForTests
        CreepyTowers.Tests.Bosses BossTests

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

public class BossTests : CreepyTowersGameForTests

The BossTests type exposes the following members.

Constructors

  NameDescription
Public methodBossTests
Initializes a new instance of the BossTests class
Top
Methods

  NameDescription
Protected methodAdvanceTimeAndUpdateEntities (Inherited from TestWithMocksOrVisually.)
Public methodCheckDirectionOfBossVillainWithoutPath
Public methodCheckGoldRewardForBoss
Public methodCheckReceiveAttack
Public methodCheckReceiveAttackWithDeadBoss
Public methodCheckReceiveAttackWithInactiveBoss
Public methodCheckScaleUpdatingForBossVillain
Public methodDisplayBossVillainFollowingPreDefinedPath
Public methodDispose (Inherited from CreepyTowersGameForTests.)
Public methodDrawingCreepCreatesCreepModel
Public methodInitialize (Overrides CreepyTowersGameForTests Initialize .)
Public methodInitializeCreepyTowersMockContentLoader (Inherited from TestWithCreepyTowersMockContentLoaderOrVisually.)
Public methodInitializeResolver (Inherited from TestWithMocksOrVisually.)
Public methodNotDrawingCreepDoesntCreateCreepModel
Protected methodRegisterMock T  (Inherited from TestWithMocksOrVisually.)
Protected methodResolve T  (Inherited from TestWithMocksOrVisually.)
Protected methodRunAfterFirstFrame (Inherited from TestWithMocksOrVisually.)
Public methodRunTestAndDisposeResolverWhenDone (Inherited from TestWithMocksOrVisually.)
Top
Fields

  NameDescription
Protected fieldgame (Inherited from CreepyTowersGameForTests.)
Top
Properties

  NameDescription
Protected propertyIsMockResolver (Inherited from TestWithMocksOrVisually.)
Top
Examples

[Test]
public void NotDrawingCreepDoesntCreateCreepModel()
{
    new Boss(BossType.Cloak, Vector2D.Zero);
    Assert.AreEqual(0, EntitiesRunner.Current.GetEntitiesOfType<Model>().Count);
    Assert.AreEqual(1, EntitiesRunner.Current.GetEntitiesOfType<Boss>().Count);
}
[Test]
public void DrawingCreepCreatesCreepModel()
{
    var boss = new Boss(BossType.Cloak, Vector2D.Zero, 180.0f);
    boss.RenderModel();
    Assert.AreEqual(1, EntitiesRunner.Current.GetEntitiesOfType<Model>().Count);
    Assert.AreEqual(1, EntitiesRunner.Current.GetEntitiesOfType<Boss>().Count);
}
[Test, CloseAfterFirstFrame]
public void CheckScaleUpdatingForBossVillain()
{
    var boss = new Boss(BossType.Cloak, Vector2D.Zero);
    boss.RenderModel();
    boss.Scale = 3.0f * Vector3D.One;
    Assert.AreEqual(3.0f * Vector3D.One, boss.Model.Scale);
}
[Test, CloseAfterFirstFrame]
public void CheckDirectionOfBossVillainWithoutPath()
{
    var grid = new Grid3D(new Size(10, 10));
    grid.RenderLayer = -10;
    var boss = new Boss(BossType.Cloak, Vector2D.Zero);
    AdvanceTimeAndUpdateEntities(5.0f);
    Assert.AreEqual(Vector3D.Zero, boss.Direction);
}
[Test]
public void DisplayBossVillainFollowingPreDefinedPath()
{
    camera.ZoomLevel = 1 / 20.0f;
    var grid = new Grid3D(new Size(10, 10));
    grid.RenderLayer = -10;
    var boss = new Boss(BossType.Cloak, Vector2D.Zero);
    boss.RenderModel();
    boss.FinalTarget = new Vector2D(2, 2);
    boss.Path = new List<Vector2D>
    {
        new Vector2D(4, 0),
        new Vector2D(4, 9),
        new Vector2D(2, 9),
        new Vector2D(2, 2)
    };
}
[Test, CloseAfterFirstFrame]
public void CheckGoldRewardForBoss()
{
    var boss = new Boss(BossType.Cloak, Vector2D.Zero);
    Assert.AreEqual(100, boss.GetStatValue("Gold"));
}
[Test, CloseAfterFirstFrame]
public void CheckReceiveAttack()
{
    var boss = new Boss(BossType.Cloak, Vector2D.Zero);
    boss.ReceiveAttack(TowerType.Fire, 50.0f);
    Assert.AreEqual(465.0f, boss.GetStatValue("Hp"));
}
[Test, CloseAfterFirstFrame]
public void CheckReceiveAttackWithInactiveBoss()
{
    var boss = new Boss(BossType.Cloak, Vector2D.Zero);
    boss.IsActive = false;
    boss.ReceiveAttack(TowerType.Fire, 100.0f);
    Assert.IsFalse(boss.IsActive);
    Assert.AreEqual(boss.GetStatValue("Hp"), boss.GetStatBaseValue("Hp"));
}
[Test, CloseAfterFirstFrame]
public void CheckReceiveAttackWithDeadBoss()
{
    var boss = new Boss(BossType.Cloak, Vector2D.Zero);
    boss.AdjustStat(new StatAdjustment("Hp", "", -500));
    boss.ReceiveAttack(TowerType.Fire, 100.0f);
    Assert.AreEqual(0.0f, boss.GetStatValue("Hp"));
}
See Also