MainMenuTests ClassDelta Engine Documentation
Inheritance Hierarchy

System Object
  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

public class MainMenuTests : TestWithMocksOrVisually

The MainMenuTests type exposes the following members.

Constructors

  NameDescription
Public methodMainMenuTests
Initializes a new instance of the MainMenuTests class
Top
Methods

  NameDescription
Protected methodAdvanceTimeAndUpdateEntities (Inherited from TestWithMocksOrVisually.)
Public methodHowToPlay
Public methodInit
Public methodInitializeResolver (Inherited from TestWithMocksOrVisually.)
Public methodOptions
Public methodQuitGame
Protected methodRegisterMock T  (Inherited from TestWithMocksOrVisually.)
Protected methodResolve T  (Inherited from TestWithMocksOrVisually.)
Protected methodRunAfterFirstFrame (Inherited from TestWithMocksOrVisually.)
Public methodRunTestAndDisposeResolverWhenDone (Inherited from TestWithMocksOrVisually.)
Public methodStartGame
Top
Properties

  NameDescription
Protected propertyIsMockResolver (Inherited from TestWithMocksOrVisually.)
Top
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