ModelTests ClassDelta Engine Documentation
Inheritance Hierarchy

System Object
  DeltaEngine.Platforms TestWithMocksOrVisually
    DeltaEngine.Rendering3D.Tests ModelTests

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

public class ModelTests : TestWithMocksOrVisually

The ModelTests type exposes the following members.

Constructors

  NameDescription
Public methodModelTests
Initializes a new instance of the ModelTests class
Top
Methods

  NameDescription
Protected methodAdvanceTimeAndUpdateEntities (Inherited from TestWithMocksOrVisually.)
Public methodInitializeResolver (Inherited from TestWithMocksOrVisually.)
Public methodLoadInvalidModel
Public methodNullModelDrawnWontThrow
Public methodRayPick
Protected methodRegisterMock T  (Inherited from TestWithMocksOrVisually.)
Public methodRenderCubeModel
Public methodRenderLightmapSceneModel
Protected methodResolve T  (Inherited from TestWithMocksOrVisually.)
Protected methodRunAfterFirstFrame (Inherited from TestWithMocksOrVisually.)
Public methodRunTestAndDisposeResolverWhenDone (Inherited from TestWithMocksOrVisually.)
Public methodSetUp
Top
Properties

  NameDescription
Protected propertyIsMockResolver (Inherited from TestWithMocksOrVisually.)
Top
Examples

[Test, CloseAfterFirstFrame]
public void LoadInvalidModel()
{
    if (IsMockResolver)
        Assert.Throws<ModelData.NoMeshesGivenNeedAtLeastOne>(
            () => new Model("InvalidModel", Vector3D.Zero));
}
[Test, ApproveFirstFrameScreenshot]
public void RenderCubeModel()
{
    window.BackgroundColor = Color.Gray;
    Camera.Current.Position = 2 * Vector3D.One;
    new Model("Cube", Vector3D.Zero);
}
[Test]
public void RayPick()
{
    new Grid3D(new Size(10));
    Camera.Current.Position = 5 * Vector3D.One;
    var cube = new Model(new ModelData(new BoxMesh(Vector3D.One, Color.Red)), Vector3D.Zero);
    var floor = new Plane(Vector3D.UnitZ, 0.0f);
    //ncrunch: no coverage start 
    new Command(point =>
    {
        var ray = Camera.Current.ScreenPointToRay(point);
        Vector3D? intersect = floor.Intersect(ray);
        if (intersect != null)
            cube.Position = (Vector3D)intersect;
    }).Add(new MouseButtonTrigger(MouseButton.Left, State.Pressed));
}
[Test, Ignore]
public void RenderLightmapSceneModel()
{
    window.BackgroundColor = Color.White;
    Camera.Current.Position = 5 * Vector3D.One;
    new Model("LightmapSimpleScene", Vector3D.Zero);
}
[Test, CloseAfterFirstFrame]
public void NullModelDrawnWontThrow()
{
    var modelRenderer = new ModelRenderer(Resolve<Drawing>());
    Assert.DoesNotThrow(
        () => modelRenderer.Draw(new List<DrawableEntity>(new Model[] { null })));
}
See Also