Inheritance Hierarchy
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
The ActorTests type exposes the following members.
Constructors
Name | Description | |
---|---|---|
ActorTests | Initializes a new instance of the ActorTests class |
Methods
Name | Description | |
---|---|---|
AdvanceTimeAndUpdateEntities | (Inherited from TestWithMocksOrVisually.) | |
CheckChangePosition | ||
CheckChangeRotationZ | ||
CheckChangeScale | ||
CheckChangeScaleFactor | ||
InitializeResolver | (Inherited from TestWithMocksOrVisually.) | |
RegisterMock T | (Inherited from TestWithMocksOrVisually.) | |
Resolve T | (Inherited from TestWithMocksOrVisually.) | |
RunAfterFirstFrame | (Inherited from TestWithMocksOrVisually.) | |
RunTestAndDisposeResolverWhenDone | (Inherited from TestWithMocksOrVisually.) | |
TestActorSpawnDespawnNotChangeAnything | ||
TestBoundingBox | ||
TestBoundingSphere | ||
TestDrawArea | ||
TestIfTwoActorsAreCollidingIn2D | ||
TestIfTwoActorsAreCollidingIn3D |
Properties
Name | Description | |
---|---|---|
IsMockResolver | (Inherited from TestWithMocksOrVisually.) |
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