StatTests ClassDelta Engine Documentation
Inheritance Hierarchy

System Object
  DeltaEngine.Platforms TestWithMocksOrVisually
    CreepyTowers.Tests TestWithCreepyTowersMockContentLoaderOrVisually
      CreepyTowers.Tests CreepyTowersGameForTests
        CreepyTowers.Tests.Stats StatTests

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

public class StatTests : CreepyTowersGameForTests

The StatTests type exposes the following members.

Constructors

  NameDescription
Public methodStatTests
Initializes a new instance of the StatTests class
Top
Methods

  NameDescription
Public methodAddBuff
Public methodAdjust
Protected methodAdvanceTimeAndUpdateEntities (Inherited from TestWithMocksOrVisually.)
Public methodCantAdjustToAboveMaxValue
Public methodCantAdjustToBelowZero
Public methodCheckToString
Public methodConstructor
Public methodDispose (Inherited from CreepyTowersGameForTests.)
Public methodInitialize (Inherited from CreepyTowersGameForTests.)
Public methodInitializeCreepyTowersMockContentLoader (Inherited from TestWithCreepyTowersMockContentLoaderOrVisually.)
Public methodInitializeResolver (Inherited from TestWithMocksOrVisually.)
Public methodPercentage
Protected methodRegisterMock T  (Inherited from TestWithMocksOrVisually.)
Public methodRemoveBuff
Protected methodResolve T  (Inherited from TestWithMocksOrVisually.)
Protected methodRunAfterFirstFrame (Inherited from TestWithMocksOrVisually.)
Public methodRunTestAndDisposeResolverWhenDone (Inherited from TestWithMocksOrVisually.)
Public methodSetUp
Top
Fields

  NameDescription
Protected fieldgame (Inherited from CreepyTowersGameForTests.)
Top
Properties

  NameDescription
Protected propertyIsMockResolver (Inherited from TestWithMocksOrVisually.)
Top
Examples

[Test]
public void Constructor()
{
    Assert.AreEqual(100.0f, stat.BaseValue);
}
[Test]
public void Adjust()
{
    stat.Adjust(-5.0f);
    Assert.AreEqual(95.0f, stat.Value);
    Assert.AreEqual(100.0f, stat.MaxValue);
}
[Test]
public void CantAdjustToAboveMaxValue()
{
    stat.Adjust(-20.0f);
    stat.Adjust(50.0f);
    Assert.AreEqual(100.0f, stat.Value);
}
[Test]
public void CantAdjustToBelowZero()
{
    stat.Adjust(-110.0f);
    Assert.AreEqual(0.0f, stat.Value);
}
[Test]
public void AddBuff()
{
  stat.ApplyBuff(new BuffEffect("TestHpBuff"));
    Assert.AreEqual(304.0f, stat.Value);
    Assert.AreEqual(304.0f, stat.MaxValue);
}
[Test]
public void RemoveBuff()
{
    stat.ApplyBuff(new BuffEffect("TestHpBuff"));
    stat.RemoveBuff(new BuffEffect("TestHpBuff"));
    Assert.AreEqual(100.0f, stat.Value);
    Assert.AreEqual(100.0f, stat.MaxValue);
}
[Test]
public void Percentage()
{
    stat.Adjust(-40.0f);
    Assert.AreEqual(0.6f, stat.Percentage);
    Assert.AreEqual(0.0f, new Stat(0.0f).Percentage);
}
[Test]
public void CheckToString()
{
    stat.Adjust(-40.0f);
    Assert.AreEqual("60/100", stat.ToString());
}
See Also