InputCommandsTests ClassDelta Engine Documentation
Inheritance Hierarchy

System Object
  DeltaEngine.Platforms TestWithMocksOrVisually
    DeltaEngine.Content.Xml.Tests InputCommandsTests

Namespace: DeltaEngine.Content.Xml.Tests
Assembly: DeltaEngine.Content.Xml.Tests (in DeltaEngine.Content.Xml.Tests.dll) Version: 1.1.1.0 (1.1.1)
Syntax

public class InputCommandsTests : TestWithMocksOrVisually

The InputCommandsTests type exposes the following members.

Constructors

  NameDescription
Public methodInputCommandsTests
Initializes a new instance of the InputCommandsTests class
Top
Methods

  NameDescription
Protected methodAdvanceTimeAndUpdateEntities (Inherited from TestWithMocksOrVisually.)
Public methodCreateDefaultInputCommandsIfContentNotFound
Public methodInitializeResolver (Inherited from TestWithMocksOrVisually.)
Public methodLogErrorIfTriggerTypeDoesNotExist
Protected methodRegisterMock T  (Inherited from TestWithMocksOrVisually.)
Protected methodResolve T  (Inherited from TestWithMocksOrVisually.)
Protected methodRunAfterFirstFrame (Inherited from TestWithMocksOrVisually.)
Public methodRunTestAndDisposeResolverWhenDone (Inherited from TestWithMocksOrVisually.)
Public methodTestInputCommands
Top
Properties

  NameDescription
Protected propertyIsMockResolver (Inherited from TestWithMocksOrVisually.)
Top
Examples

[Test, CloseAfterFirstFrame]
public void TestInputCommands()
{
    var inputCommands = ContentLoader.Load<InputCommands>("DefaultCommands");
    Assert.AreEqual("DefaultCommands", inputCommands.Name);
    Assert.IsTrue(inputCommands.InternalAllowCreationIfContentNotFound);
}
[Test, CloseAfterFirstFrame]
public void LogErrorIfTriggerTypeDoesNotExist()
{
    var logger = new MockLogger();
    Assert.Throws<Command.UnableToRegisterCommandWithoutTriggers>(
        () =>
            ContentLoader.Load<NoDataInputCommands>("NoDataInputCommands").InternalCreateDefault());
    Assert.IsTrue(logger.LastMessage.Contains(NonTriggerTypeName), logger.LastMessage);
    Assert.IsTrue(logger.LastMessage.Contains("MissingMethodException"), logger.LastMessage);
    logger.Dispose();
}
[Test, CloseAfterFirstFrame, Timeout(5000)]
public void CreateDefaultInputCommandsIfContentNotFound()
{
    var inputCommands = ContentLoader.Load<NotExistingInputCommands>("NotExistingInputCommands");
    inputCommands.InternalCreateDefault();
    foreach (var commandData in inputCommands.Data.Children)
    {
        Assert.IsNotEmpty(commandData.Name);
        Assert.IsNull(commandData.Value);
    }
    var exitCommand = new Command(Command.Exit, (Action)null);
    List<Trigger> triggers = exitCommand.GetTriggers();
    Assert.AreEqual(1, triggers.Count);
    Assert.AreEqual("KeyTrigger", triggers[0].GetShortNameOrFullNameIfNotFound());
}
See Also