Inheritance Hierarchy
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
The StatTests type exposes the following members.
Constructors
Name | Description | |
---|---|---|
![]() | StatTests | Initializes a new instance of the StatTests class |
Methods
Name | Description | |
---|---|---|
![]() | AddBuff | |
![]() | Adjust | |
![]() | AdvanceTimeAndUpdateEntities | (Inherited from TestWithMocksOrVisually.) |
![]() | CantAdjustToAboveMaxValue | |
![]() | CantAdjustToBelowZero | |
![]() | CheckToString | |
![]() | Constructor | |
![]() | Dispose | (Inherited from CreepyTowersGameForTests.) |
![]() | Initialize | (Inherited from CreepyTowersGameForTests.) |
![]() | InitializeCreepyTowersMockContentLoader | (Inherited from TestWithCreepyTowersMockContentLoaderOrVisually.) |
![]() | InitializeResolver | (Inherited from TestWithMocksOrVisually.) |
![]() | Percentage | |
![]() | RegisterMock T | (Inherited from TestWithMocksOrVisually.) |
![]() | RemoveBuff | |
![]() | Resolve T | (Inherited from TestWithMocksOrVisually.) |
![]() | RunAfterFirstFrame | (Inherited from TestWithMocksOrVisually.) |
![]() | RunTestAndDisposeResolverWhenDone | (Inherited from TestWithMocksOrVisually.) |
![]() | SetUp |
Fields
Name | Description | |
---|---|---|
![]() | game | (Inherited from CreepyTowersGameForTests.) |
Properties
Name | Description | |
---|---|---|
![]() | IsMockResolver | (Inherited from TestWithMocksOrVisually.) |
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