MovementTests ClassDelta Engine Documentation
Inheritance Hierarchy

System Object
  DeltaEngine.Platforms TestWithMocksOrVisually
    CreepyTowers.Tests.Creeps MovementTests

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

public class MovementTests : TestWithMocksOrVisually

The MovementTests type exposes the following members.

Constructors

  NameDescription
Public methodMovementTests
Initializes a new instance of the MovementTests class
Top
Methods

  NameDescription
Protected methodAdvanceTimeAndUpdateEntities (Inherited from TestWithMocksOrVisually.)
Public methodCreepWithNoPathDoesntMove
Public methodDelayedCreepMovesAtThirdSpeed
Public methodFastCreepMovesAtDoubleSpeed
Public methodFrozenCreepDoesNotMove
Public methodInitializeResolver (Inherited from TestWithMocksOrVisually.)
Public methodParalyzedCreepDoesNotMove
Protected methodRegisterMock T  (Inherited from TestWithMocksOrVisually.)
Protected methodResolve T  (Inherited from TestWithMocksOrVisually.)
Protected methodRunAfterFirstFrame (Inherited from TestWithMocksOrVisually.)
Public methodRunTestAndDisposeResolverWhenDone (Inherited from TestWithMocksOrVisually.)
Public methodSetUp
Public methodSlowCreepMovesAtHalfSpeed
Public methodUnchangedCreepMovesAtDefaultSpeed
Top
Properties

  NameDescription
Protected propertyIsMockResolver (Inherited from TestWithMocksOrVisually.)
Top
Examples

[Test, CloseAfterFirstFrame]
public void ParalyzedCreepDoesNotMove()
{
    creep.State.Paralysed = true;
    AdvanceTimeAndUpdateEntities(1);
    Assert.AreEqual(Vector3D.Zero, creep.Position);
}
[Test, CloseAfterFirstFrame]
public void FrozenCreepDoesNotMove()
{
    creep.State.Frozen = true;
    AdvanceTimeAndUpdateEntities(1);
    Assert.AreEqual(Vector3D.Zero, creep.Position);
}
[Test, CloseAfterFirstFrame]
public void DelayedCreepMovesAtThirdSpeed()
{
    creep.State.Delayed = true;
    AdvanceTimeAndUpdateEntities(1);
    Assert.AreEqual(0.333f, creep.Position.X, 0.001f);
}
[Test, CloseAfterFirstFrame]
public void SlowCreepMovesAtHalfSpeed()
{
    creep.State.Slow = true;
    AdvanceTimeAndUpdateEntities(1);
    Assert.AreEqual(0.5f, creep.Position.X, 0.001f);
}
[Test, CloseAfterFirstFrame]
public void FastCreepMovesAtDoubleSpeed()
{
    creep.State.Fast = true;
    AdvanceTimeAndUpdateEntities(1);
    Assert.AreEqual(2.0f, creep.Position.X, 0.001f);
}
[Test, CloseAfterFirstFrame]
public void UnchangedCreepMovesAtDefaultSpeed()
{
    AdvanceTimeAndUpdateEntities(1);
    Assert.AreEqual(1.0f, creep.Position.X, 0.001f);
}
[Test, CloseAfterFirstFrame]
public void CreepWithNoPathDoesntMove()
{
    creep.Path = new List<Vector2D>();
    AdvanceTimeAndUpdateEntities(1);
    Assert.AreEqual(0.0f, creep.Position.X);
}
See Also