BouncingLogoTests ClassDelta Engine Documentation
Inheritance Hierarchy

System Object
  DeltaEngine.Platforms TestWithMocksOrVisually
    LogoApp.Tests BouncingLogoTests

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

public class BouncingLogoTests : TestWithMocksOrVisually

The BouncingLogoTests type exposes the following members.

Constructors

  NameDescription
Public methodBouncingLogoTests
Initializes a new instance of the BouncingLogoTests class
Top
Methods

  NameDescription
Protected methodAdvanceTimeAndUpdateEntities (Inherited from TestWithMocksOrVisually.)
Public methodCallBouncedAction
Public methodCreate
Public methodDraw1000LogosToTestPerformance
Public methodDrawing100LogosOnlyCauseOneDrawCall
Public methodInitializeResolver (Inherited from TestWithMocksOrVisually.)
Public methodPressingSpacePausesLogoApp
Protected methodRegisterMock T  (Inherited from TestWithMocksOrVisually.)
Protected methodResolve T  (Inherited from TestWithMocksOrVisually.)
Public methodRunAFewTimesAndCloseGame
Protected methodRunAfterFirstFrame (Inherited from TestWithMocksOrVisually.)
Public methodRunTestAndDisposeResolverWhenDone (Inherited from TestWithMocksOrVisually.)
Public methodShowManyLogos
Top
Properties

  NameDescription
Protected propertyIsMockResolver (Inherited from TestWithMocksOrVisually.)
Top
Examples

[Test]
public void Create()
{
    var logo = new BouncingLogo();
    Assert.IsTrue(logo.Center.X > 0);
    Assert.IsTrue(logo.Center.Y > 0);
    Assert.AreNotEqual(Color.Black, logo.Color);
}
[Test]
public void ShowManyLogos()
{
    for (int i = 0; i < 100; i++)
        new BouncingLogo();
}
[Test]
public void Drawing100LogosOnlyCauseOneDrawCall()
{
    for (int i = 0; i < 100; i++)
        new BouncingLogo();
    RunAfterFirstFrame(() =>
    {
        Assert.AreEqual(1, Resolve<Drawing>().NumberOfDynamicDrawCallsThisFrame);
        Assert.AreEqual(100 * 4, Resolve<Drawing>().NumberOfDynamicVerticesDrawnThisFrame);
    });
}
[Test]
public void PressingSpacePausesLogoApp()
{
    for (int i = 0; i < 10; i++)
        new BouncingLogo();
    new Command(() => Time.IsPaused = !Time.IsPaused).Add(new KeyTrigger(Key.Space));
}
[Test]
public void CallBouncedAction()
{
    var bouncingLogo = new ActionTesterBouncingLogo();
    Assert.IsFalse(bouncingLogo.BouncedActionCalled);
    AdvanceTimeAndUpdateEntities();
    Assert.IsTrue(bouncingLogo.BouncedActionCalled);
}
[Test, Ignore]
public void Draw1000LogosToTestPerformance()
{
    for (int i = 0; i < 1000; i++)
        new BouncingLogo();
}
[Test, Ignore]
public void RunAFewTimesAndCloseGame()
{
    new BouncingLogo();
    AdvanceTimeAndUpdateEntities(1.0f);
}
See Also