public void Initialize_Registers_Commands() { TestCommandModel expected = new TestCommandModel(); commandFactory.CreateFromAssembliesCommand.Add("", expected); model.Initialize(); Assert.AreEqual(expected, model.Commands.Values.Single()); }
public void ParseArgs_Ignores_Extra_Args() { TestCommandModel cmd = new TestCommandModel { Parameters = new ParameterInfo[0] }; object[] result = model.ParseArgs(cmd, new[] { "1" }); Assert.AreEqual(0, result.Length); }
public void ExecuteCommand_Non_Existing_Returns_Error_Log() { TestCommandModel command = new TestCommandModel(); bool called = false; command.OnInvokeCalled += x => called = true; commandsCollection.Commands.Add("foo", command); Model.ExecuteCommand("bar", new[] { "3" }); Assert.IsFalse(called); }
public void ExecuteCommand_Invokes_Command() { TestCommandModel command = new TestCommandModel(); object[] result = null; command.OnInvokeCalled += x => result = x; commandsCollection.Commands.Add("foo", command); commandParser.ParseArgsReturnValue = new object[] { 3 }; Model.ExecuteCommand("foo", new[] { "3" }); Assert.AreEqual(3, result[0]); }
public void RegisterRuntimeCommand_Registers_Command() { TestCommandModel expected = new TestCommandModel(); commandFactory.CreateCommand = expected; model.RegisterRuntimeCommand("", default, default, default, default);