Inheritance Hierarchy
DeltaEngine.Platforms TestWithMocksOrVisually
Breakout.Tests MainMenuTests
Namespace: Breakout.Tests
Assembly: Breakout.Tests (in Breakout.Tests.dll) Version: 1.1.1.0 (1.1.1)
Syntax
The MainMenuTests type exposes the following members.
Constructors
Name | Description | |
---|---|---|
MainMenuTests | Initializes a new instance of the MainMenuTests class |
Methods
Name | Description | |
---|---|---|
AdvanceTimeAndUpdateEntities | (Inherited from TestWithMocksOrVisually.) | |
HowToPlay | ||
Init | ||
InitializeResolver | (Inherited from TestWithMocksOrVisually.) | |
Options | ||
QuitGame | ||
RegisterMock T | (Inherited from TestWithMocksOrVisually.) | |
Resolve T | (Inherited from TestWithMocksOrVisually.) | |
RunAfterFirstFrame | (Inherited from TestWithMocksOrVisually.) | |
RunTestAndDisposeResolverWhenDone | (Inherited from TestWithMocksOrVisually.) | |
StartGame |
Properties
Name | Description | |
---|---|---|
IsMockResolver | (Inherited from TestWithMocksOrVisually.) |
Examples
[Test] public void StartGame() { if (!IsMockResolver) return; //ncrunch: no coverage bool started = false; menu.InitGame += () => started = true; var mouse = Resolve<MockMouse>(); ClickAtPosition(mouse, new Vector2D(0.31f, 0.31f)); Assert.IsTrue(started); }
[Test] public void QuitGame() { if (!IsMockResolver) return; //ncrunch: no coverage bool quit = false; menu.QuitGame += () => quit = true; var mouse = Resolve<MockMouse>(); ClickAtPosition(mouse, new Vector2D(0.31f, 0.73f)); Assert.IsTrue(quit); }
[Test, Ignore] public void HowToPlay() { if (!IsMockResolver) return; //ncrunch: no coverage var mouse = Resolve<MockMouse>(); ClickAtPosition(mouse, new Vector2D(0.31f, 0.45f)); Assert.IsFalse(menu.Controls[0].IsVisible); ClickAtPosition(mouse, new Vector2D(0.31f, ScreenSpace.Current.Bottom - 0.19f)); Assert.IsTrue(menu.Controls[0].IsVisible); }
[Test, Ignore] public void Options() { if (!IsMockResolver) return; //ncrunch: no coverage var mouse = Resolve<MockMouse>(); Settings.Current.MusicVolume = 0.5f; Settings.Current.SoundVolume = 0.5f; ClickAtPosition(mouse, new Vector2D(0.31f, 0.59f)); Assert.IsFalse(menu.Controls[0].IsVisible); bool changed = false; MainMenu.SettingsChanged += () => changed = true; DragMouse(mouse, 0.81f, ScreenSpace.Current.Viewport.Top + 0.46f); Assert.IsTrue(changed); changed = false; DragMouse(mouse, 0.81f, ScreenSpace.Current.Viewport.Top + 0.6f); Assert.IsTrue(changed); ClickAtPosition(mouse, new Vector2D(0.31f, ScreenSpace.Current.Bottom - 0.19f)); Assert.IsTrue(menu.Controls[0].IsVisible); }
See Also