ActorTests ClassDelta Engine Documentation
Inheritance Hierarchy

System Object
  DeltaEngine.Platforms TestWithMocksOrVisually
    DeltaEngine.GameLogic.Tests ActorTests

Namespace: DeltaEngine.GameLogic.Tests
Assembly: DeltaEngine.GameLogic.Tests (in DeltaEngine.GameLogic.Tests.dll) Version: 1.1.1.0 (1.1.1)
Syntax

public class ActorTests : TestWithMocksOrVisually

The ActorTests type exposes the following members.

Constructors

  NameDescription
Public methodActorTests
Initializes a new instance of the ActorTests class
Top
Methods

  NameDescription
Protected methodAdvanceTimeAndUpdateEntities (Inherited from TestWithMocksOrVisually.)
Public methodCheckChangePosition
Public methodCheckChangeRotationZ
Public methodCheckChangeScale
Public methodCheckChangeScaleFactor
Public methodInitializeResolver (Inherited from TestWithMocksOrVisually.)
Protected methodRegisterMock T  (Inherited from TestWithMocksOrVisually.)
Protected methodResolve T  (Inherited from TestWithMocksOrVisually.)
Protected methodRunAfterFirstFrame (Inherited from TestWithMocksOrVisually.)
Public methodRunTestAndDisposeResolverWhenDone (Inherited from TestWithMocksOrVisually.)
Public methodTestActorSpawnDespawnNotChangeAnything
Public methodTestBoundingBox
Public methodTestBoundingSphere
Public methodTestDrawArea
Public methodTestIfTwoActorsAreCollidingIn2D
Public methodTestIfTwoActorsAreCollidingIn3D
Top
Properties

  NameDescription
Protected propertyIsMockResolver (Inherited from TestWithMocksOrVisually.)
Top
Examples

[Test]
public void TestActorSpawnDespawnNotChangeAnything()
{
    var actor = new MockActor(Vector3D.One, 1.0f);
    actor.RenderModel();
    Assert.IsFalse(actor.Is2D());
    Assert.AreEqual(Vector3D.One, actor.Position);
}
[Test]
public void CheckChangePosition()
{
    var actor = new MockActor(Vector3D.One, 1.0f);
    actor.PositionChanged += () => { CheckPositionHasChanged(actor); };
    actor.Position = new Vector3D(2, 2, 2);
}
[Test]
public void CheckChangeScale()
{
    var actor = new MockActor(Vector3D.One, 1.0f);
    actor.ScaleChanged += () => { CheckScaleHasChanged(actor); };
    actor.Scale = new Vector3D(2, 2, 2);
}
[Test]
public void CheckChangeRotationZ()
{
    var actor = new MockActor(Vector3D.One, 1.0f);
    actor.OrientationChanged += () => { CheckRotationZHasChanged(actor); };
    actor.RotationZ = 90.0f;
}
[Test]
public void CheckChangeScaleFactor()
{
    var actor = new MockActor(Vector3D.One, 1.0f);
    actor.ScaleFactor = 2;
    Assert.AreEqual(2, actor.ScaleFactor);
}
[Test]
public void TestDrawArea()
{
    var actor = new MockActor(Vector3D.One, 1.0f);
    Assert.AreEqual(new Rectangle(0.5f, 0.5f, 1, 1), actor.GetDrawArea());
}
[Test]
public void TestBoundingBox()
{
    var actor = new MockActor(Vector3D.One, 1.0f);
    var box = new BoundingBox(new Vector3D(0.5f, 0.5f, 0.5f), new Vector3D(1.5f, 1.5f, 1.5f));
    Assert.AreEqual(box, actor.GetBoundingBox());
}
[Test]
public void TestBoundingSphere()
{
    var actor = new MockActor(Vector3D.One, 1.0f);
    var sphere = new BoundingSphere(Vector3D.One, 1.0f);
    Assert.AreEqual(sphere, actor.GetBoundingSphere());
}
[Test]
public void TestIfTwoActorsAreCollidingIn3D()
{
    var actor1 = new MockActor(Vector3D.One, 1.0f);
    var actor2 = new MockActor(Vector3D.Zero, 0.0f);
    Assert.IsTrue(actor1.IsColliding(actor2));
}
[Test]
public void TestIfTwoActorsAreCollidingIn2D()
{
    var actor1 = new MockActor(Vector2D.One, 0.0f, Vector2D.One);
    var actor2 = new MockActor(Vector2D.Zero, 0.0f, Vector2D.One);
    Assert.IsTrue(actor1.IsColliding(actor2));
}
See Also