BodyTests ClassDelta Engine Documentation
Inheritance Hierarchy

System Object
  DeltaEngine.Platforms TestWithMocksOrVisually
    DeltaEngine.Physics2D.Farseer.Tests BodyTests

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

public class BodyTests : TestWithMocksOrVisually

The BodyTests type exposes the following members.

Constructors

  NameDescription
Public methodBodyTests
Initializes a new instance of the BodyTests class
Top
Methods

  NameDescription
Protected methodAdvanceTimeAndUpdateEntities (Inherited from TestWithMocksOrVisually.)
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 methodSetUp
Public methodTestApplyAngularImpulse
Public methodTestApplyLinearImpulse
Public methodTestApplyTorque
Public methodTestBodyDefaultFriction
Public methodTestBodyDefaultIsNotStatic
Public methodTestBodyDefaultPosition
Public methodTestBodyDefaultSetStatic
Public methodTestBodyRestitution
Public methodTestBodySetFriction
Public methodTestBodySetPosition
Public methodTestEmptyRectangleShapeNotAllowed
Public methodTestStaticBodyNoRotation
Top
Properties

  NameDescription
Protected propertyIsMockResolver (Inherited from TestWithMocksOrVisually.)
Top
Examples

[Test]
public void TestBodyDefaultIsNotStatic()
{
    var body = physics.CreateCircle(45.0f);
    Assert.IsFalse(body.IsStatic);
}
[Test]
public void TestBodyDefaultSetStatic()
{
    var body = physics.CreateRectangle(new Size(45.0f, 45.0f));
    body.IsStatic = true;
    Assert.IsTrue(body.IsStatic);
}
[Test]
public void TestBodyDefaultFriction()
{
    var body = physics.CreateRectangle(new Size(45.0f, 45.0f));
    Assert.AreEqual(body.Friction, DefaultFriction);
}
[Test]
public void TestBodySetFriction()
{
    var body = physics.CreateRectangle(new Size(45.0f, 45.0f));
    body.Friction = 0.5f;
    Assert.AreEqual(body.Friction, 0.5f);
}
[Test]
public void TestBodyDefaultPosition()
{
    var body = physics.CreateRectangle(new Size(45.0f, 45.0f));
    Assert.AreEqual(body.Position, Vector2D.Zero);
}
[Test]
public void TestBodySetPosition()
{
    var body = physics.CreateRectangle(new Size(45.0f, 45.0f));
    body.Position = new Vector2D(100, 100);
    Assert.AreEqual(body.Position, new Vector2D(100, 100));
}
[Test]
public void TestBodyRestitution()
{
    var body = physics.CreateRectangle(new Size(45.0f, 45.0f));
    body.Restitution = 0.5f;
    Assert.AreEqual(body.Restitution, 0.5f);
}
[Test]
public void TestStaticBodyNoRotation()
{
    var body = physics.CreateRectangle(new Size(45.0f, 45.0f));
    body.IsStatic = true;
    Assert.AreEqual(body.Rotation, 0.0f);
}
[Test]
public void TestApplyLinearImpulse()
{
    var body = physics.CreateRectangle(new Size(45.0f, 45.0f));
    Assert.IsNotNull(body);
    body.ApplyLinearImpulse(Vector2D.Zero);
}
[Test]
public void TestApplyAngularImpulse()
{
    var body = physics.CreateRectangle(new Size(45.0f, 45.0f));
    Assert.IsNotNull(body);
    body.ApplyAngularImpulse(10.0f);
}
[Test]
public void TestApplyTorque()
{
    var body = physics.CreateRectangle(new Size(45.0f, 45.0f));
    Assert.IsNotNull(body);
    body.ApplyTorque(10.0f);
}
[Test]
public void TestEmptyRectangleShapeNotAllowed()
{
    Assert.Throws<ArgumentOutOfRangeException>(() => physics.CreateRectangle(Size.Zero));
}
See Also