ChunkTests ClassDelta Engine Documentation
Inheritance Hierarchy

System Object
  DeltaEngine.Platforms TestWithMocksOrVisually
    Snake.Tests ChunkTests

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

public class ChunkTests : TestWithMocksOrVisually

The ChunkTests type exposes the following members.

Constructors

  NameDescription
Public methodChunkTests
Initializes a new instance of the ChunkTests class
Top
Methods

  NameDescription
Protected methodAdvanceTimeAndUpdateEntities (Inherited from TestWithMocksOrVisually.)
Public methodCheckChunkSpawnWithinSnakeBody
Public methodCreateFirstChunk
Public methodDrawChunkAtRandomLocation
Public methodInit
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.)
Top
Properties

  NameDescription
Protected propertyIsMockResolver (Inherited from TestWithMocksOrVisually.)
Top
Examples

[Test]
public void CreateFirstChunk()
{
    var chunk = new Chunk(gridSize, blockSize, Color.Purple);
    Assert.IsTrue(chunk.IsActive);
    Assert.AreEqual(blockSize, chunk.Size.Width);
    Assert.AreEqual(blockSize, chunk.Size.Height);
    Assert.AreEqual(Color.Purple, chunk.Color);
    Assert.LessOrEqual(0.0f, chunk.DrawArea.Left);
    Assert.LessOrEqual(0.0f, chunk.DrawArea.Top);
    Assert.GreaterOrEqual(1.0f, chunk.DrawArea.Left);
    Assert.GreaterOrEqual(1.0f, chunk.DrawArea.Top);
}
[Test]
public void DrawChunkAtRandomLocation()
{
    Resolve<Window>().ViewportPixelSize = new Size(800, 600);
    var smallChunk = new Chunk(gridSize, blockSize, Color.Purple);
    smallChunk.SpawnAtRandomLocation();
}
[Test]
public void CheckChunkSpawnWithinSnakeBody()
{
    Resolve<Window>().ViewportPixelSize = new Size(200, 200);
    new Snake(gridSize, Color.Green);
    new Chunk(gridSize, blockSize, Color.Purple);
}
See Also