Inheritance Hierarchy
DeltaEngine.Platforms TestWithMocksOrVisually
TinyPlatformer.Tests GameTests
Namespace: TinyPlatformer.Tests
Assembly: TinyPlatformer.Tests (in TinyPlatformer.Tests.dll) Version: 1.1.1.0 (1.1.1)
Syntax
The GameTests type exposes the following members.
Constructors
Name | Description | |
---|---|---|
GameTests | Initializes a new instance of the GameTests class |
Methods
Properties
Name | Description | |
---|---|---|
IsMockResolver | (Inherited from TestWithMocksOrVisually.) |
Examples
[Test, CloseAfterFirstFrame] public void PlayerDoesNotWantToMoveLeftOrRight() { Assert.IsFalse(player.WantsToGoLeft); Assert.IsFalse(player.WantsToGoRight); Assert.IsFalse(player.WantsToJump); }
[Test, CloseAfterFirstFrame] public void CursorLeftMakesPlayerWantToMoveLeft() { PressKey(Key.CursorLeft); Assert.IsTrue(player.WantsToGoLeft); Assert.IsFalse(player.WantsToGoRight); Assert.IsFalse(player.WantsToJump); }
[Test, CloseAfterFirstFrame] public void CursorRightMakesPlayerWantToMoveRight() { PressKey(Key.CursorRight); Assert.IsFalse(player.WantsToGoLeft); Assert.IsTrue(player.WantsToGoRight); Assert.IsFalse(player.WantsToJump); }
[Test, CloseAfterFirstFrame] public void CursorUpMakesPlayerWantToJump() { PressKey(Key.CursorUp); Assert.IsFalse(player.WantsToGoLeft); Assert.IsFalse(player.WantsToGoRight); Assert.IsTrue(player.WantsToJump); }
[Test, CloseAfterFirstFrame] public void SpaceMakesPlayerWantToJump() { PressKey(Key.Space); Assert.IsFalse(player.WantsToGoLeft); Assert.IsFalse(player.WantsToGoRight); Assert.IsTrue(player.WantsToJump); }
[Test, CloseAfterFirstFrame] public void ReleasingCursorLeftMakesPlayerStopWantingToMoveLeft() { PressKey(Key.CursorLeft); ReleaseKey(Key.CursorLeft); Assert.IsFalse(player.WantsToGoLeft); Assert.IsFalse(player.WantsToGoRight); Assert.IsFalse(player.WantsToJump); }
[Test, CloseAfterFirstFrame] public void ReleasingCursorRightMakesPlayerStopWantingToMoveRight() { PressKey(Key.CursorRight); ReleaseKey(Key.CursorRight); Assert.IsFalse(player.WantsToGoLeft); Assert.IsFalse(player.WantsToGoRight); Assert.IsFalse(player.WantsToJump); }
[Test, CloseAfterFirstFrame] public void ReleasingCursorUpMakesPlayerStopWantingToJump() { PressKey(Key.CursorUp); ReleaseKey(Key.CursorUp); Assert.IsFalse(player.WantsToGoLeft); Assert.IsFalse(player.WantsToGoRight); Assert.IsFalse(player.WantsToJump); }
[Test, CloseAfterFirstFrame] public void ReleasingSpaceMakesPlayerStopWantingToJump() { PressKey(Key.Space); ReleaseKey(Key.Space); Assert.IsFalse(player.WantsToGoLeft); Assert.IsFalse(player.WantsToGoRight); Assert.IsFalse(player.WantsToJump); }
See Also