private void RegisterCommands() { TcpAppPlugin.RegisterCommand("Sum", "Add arguments", Sum, TcpAppParameter.CreateParameterArray("Values", "value to sum", false)); TcpAppPlugin.RegisterQueuedCommand("SumQ", "Add arguments", SumQ, TcpAppParameter.CreateParameterArray("Values", "value to sum", false)); TcpAppPlugin.RegisterCommand("TimeoutSim", "Simulate Timeout", TimeoutSim); }
public void RegisterCommandWithParameterArray() { TcpAppServer server = new TcpAppServer(); server.RegisterCommand("DummyCommand", "Dummy", null, TcpAppParameter.CreateParameter("P1", "Param 1"), TcpAppParameter.CreateParameter("P2", "Param 2"), TcpAppParameter.CreateParameterArray("PArr1", "Array Param 1", true) ); }
public void RegisterCommandWithParameterArray_ArrayNotLastParam_ArgumentException() { TcpAppServer server = new TcpAppServer(); Assert.Throws <ArgumentException>(() => { server.RegisterCommand("DummyCommand", "Dummy", null, TcpAppParameter.CreateParameter("P1", "Param 1"), TcpAppParameter.CreateParameterArray("PArr1", "Array Param 1", true), TcpAppParameter.CreateParameter("P2", "Param 2") ); }); }
public void TestCommand_Clone() { TcpAppCommand cmd = new TcpAppCommand("CMD", "Dummy Command", null); cmd.AddParameter(TcpAppParameter.CreateParameter("P1", "Parameter 1")); cmd.AddParameter(TcpAppParameter.CreateParameter("P2", "Parameter 2")); cmd.AddParameter(TcpAppParameter.CreateParameterArray("Array1", "Array 1", false)); TcpAppCommand cloned = cmd.Clone() as TcpAppCommand; Assert.AreEqual("CMD", cloned.Keyword); Assert.AreEqual("Dummy Command", cloned.Description); Assert.AreEqual(3, cloned.Parameters.Count()); Assert.AreEqual("Array 1", cloned.Parameters[2].Description); }