MapTests ClassDelta Engine Documentation
Inheritance Hierarchy

System Object
  DeltaEngine.Platforms TestWithMocksOrVisually
    TinyPlatformer.Tests MapTests

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

public class MapTests : TestWithMocksOrVisually

The MapTests type exposes the following members.

Constructors

  NameDescription
Public methodMapTests
Initializes a new instance of the MapTests class
Top
Methods

  NameDescription
Protected methodAdvanceTimeAndUpdateEntities (Inherited from TestWithMocksOrVisually.)
Public methodCheckEntityLoading
Public methodCheckGetColor
Public methodCheckMapContent
Public methodCheckMapSize
Public methodInitializeResolver (Inherited from TestWithMocksOrVisually.)
Public methodMonsterKillAddsThreeToScore
Protected methodRegisterMock T  (Inherited from TestWithMocksOrVisually.)
Protected methodResolve T  (Inherited from TestWithMocksOrVisually.)
Protected methodRunAfterFirstFrame (Inherited from TestWithMocksOrVisually.)
Public methodRunTestAndDisposeResolverWhenDone (Inherited from TestWithMocksOrVisually.)
Public methodScoreStartsAtZero
Public methodSetUp
Public methodTreasureAddsOneToScore
Top
Properties

  NameDescription
Protected propertyIsMockResolver (Inherited from TestWithMocksOrVisually.)
Top
Examples

[Test, CloseAfterFirstFrame]
public void CheckMapSize()
{
    Assert.AreEqual(8, map.width);
    Assert.AreEqual(6, map.height);
}
[Test, CloseAfterFirstFrame]
public void CheckMapContent()
{
    Assert.AreEqual(BlockType.LevelBorder, map.Blocks[0, 0]);
    Assert.AreEqual(BlockType.None, map.Blocks[1, 1]);
}
[Test, CloseAfterFirstFrame]
public void CheckEntityLoading()
{
    Assert.AreEqual(1, map.actorList.FindAll(actor => actor.type == "player").Count);
    Assert.AreEqual(1, map.actorList.FindAll(actor => actor.type == "monster").Count);
    Assert.AreEqual(1, map.actorList.FindAll(actor => actor.type == "treasure").Count);
}
[Test, CloseAfterFirstFrame]
public void CheckGetColor()
{
    Assert.AreEqual(Color.Gold, Map.GetColor(BlockType.Gold));
    Assert.AreEqual(Color.Orange, Map.GetColor(BlockType.GroundBrick));
    Assert.AreEqual(Color.Red, Map.GetColor(BlockType.PlatformBrick));
    Assert.AreEqual(Color.Purple, Map.GetColor(BlockType.PlatformTop));
    Assert.AreEqual(Color.Teal, Map.GetColor(BlockType.LevelBorder));
    Assert.AreEqual(Color.TransparentBlack, Map.GetColor(BlockType.None));
}
[Test, CloseAfterFirstFrame]
public void ScoreStartsAtZero()
{
    Assert.AreEqual(0, map.score);
    Assert.AreEqual("Score: 0", map.scoreText.Text);
}
[Test, CloseAfterFirstFrame]
public void TreasureAddsOneToScore()
{
    map.AddToScore("treasure");
    Assert.AreEqual(1, map.score);
    Assert.AreEqual("Score: 1", map.scoreText.Text);
}
[Test, CloseAfterFirstFrame]
public void MonsterKillAddsThreeToScore()
{
    map.AddToScore("monster");
    Assert.AreEqual(3, map.score);
    Assert.AreEqual("Score: 3", map.scoreText.Text);
}
See Also