BrickTests ClassDelta Engine Documentation
Unit tests for Brick View code on GitHub
Inheritance Hierarchy

System Object
  DeltaEngine.Platforms TestWithMocksOrVisually
    Blocks.Tests BrickTests

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

public class BrickTests : TestWithMocksOrVisually

The BrickTests type exposes the following members.

Constructors

  NameDescription
Public methodBrickTests
Initializes a new instance of the BrickTests class
Top
Methods

  NameDescription
Protected methodAdvanceTimeAndUpdateEntities (Inherited from TestWithMocksOrVisually.)
Public methodConstants
Public methodConstructor
Public methodInitializeResolver (Inherited from TestWithMocksOrVisually.)
Public methodOffset
Public methodPosition
Protected methodRegisterMock T  (Inherited from TestWithMocksOrVisually.)
Public methodRenderBrick
Public methodRenderBrickInLandscapeMode
Public methodRenderBrickInPortraitMode
Protected methodResolve T  (Inherited from TestWithMocksOrVisually.)
Protected methodRunAfterFirstFrame (Inherited from TestWithMocksOrVisually.)
Public methodRunTestAndDisposeResolverWhenDone (Inherited from TestWithMocksOrVisually.)
Public methodSetUp
Public methodTopLeft
Top
Properties

  NameDescription
Protected propertyIsMockResolver (Inherited from TestWithMocksOrVisually.)
Top
Examples

[Test, CloseAfterFirstFrame]
public void Constructor()
{
    var brick = new Brick(material, Vector2D.Half, displayMode);
    Assert.AreEqual(Vector2D.Half, brick.Offset);
}
[Test, CloseAfterFirstFrame]
public void Constants()
{
    Assert.AreEqual(new Vector2D(0.38f, 0.385f), Brick.OffsetLandscape);
    Assert.AreEqual(0.02f, Brick.ZoomLandscape);
}
[Test, CloseAfterFirstFrame]
public void Offset()
{
    var brick = new Brick(material, Vector2D.Zero, displayMode) { Offset = Vector2D.Half };
    Assert.AreEqual(Vector2D.Half, brick.Offset);
}
[Test, CloseAfterFirstFrame]
public void TopLeft()
{
    var brick = new Brick(material, Vector2D.Zero, displayMode) { TopLeftGridCoord = Vector2D.Half };
    Assert.AreEqual(Vector2D.Half, brick.TopLeftGridCoord);
}
[Test, CloseAfterFirstFrame]
public void Position()
{
    var brick = new Brick(material, new Vector2D(0.1f, 0.2f), displayMode)
    {
        TopLeftGridCoord = new Vector2D(0.4f, 0.8f)
    };
    Assert.AreEqual(new Vector2D(0.5f, 1.0f), brick.Position);
}
[Test, CloseAfterFirstFrame]
public void RenderBrick()
{
    var brick = new Brick(material, new Vector2D(5, 5), displayMode);
    brick.UpdateDrawArea();
}
[Test]
public void RenderBrickInLandscapeMode()
{
    Resolve<Window>().ViewportPixelSize = new Size(600, 800);
    var brick = new Brick(material, new Vector2D(5, 5), Orientation.Landscape);
    brick.UpdateDrawArea();
}
[Test]
public void RenderBrickInPortraitMode()
{
    Resolve<Window>().ViewportPixelSize = new Size(600, 800);
    var brick = new Brick(material, new Vector2D(5, 5), Orientation.Portrait);
    brick.UpdateDrawArea();
}
See Also