CSharpTest.Net
AddCommand Method
See Also  Example Send Feedback Download Help File
CSharpTest.Net.Library Assembly > CSharpTest.Net.Commands Namespace > CommandInterpreter Class : AddCommand Method

command

Glossary Item Box

Manually adds a command

Syntax

Visual Basic (Declaration) 
Public Sub AddCommand( _
   ByVal command As ICommand _
) 
C# 
public void AddCommand( 
   ICommand command
)

Parameters

command

Example

Library/Library.Test/TestCmdInterpreter.cs

C#Copy Code
string result;
CommandInterpreter ci = new CommandInterpreter(DefaultCommands.None, new TestCommands(), typeof(StaticTestFilter));
Assert.AreEqual(1, ci.Filters.Length);
Assert.AreEqual("AddLineNumbers", ci.Filters[0].DisplayName);

result = Capture(ci, "Count 2 /linenumbers");
Assert.AreEqual("1: 1\r\n2: 2", result);

int cmds = ci.Commands.Length;
ci.AddCommand(ci.Filters[0]);
Assert.AreEqual(cmds + 1, ci.Commands.Length);

result = Capture(ci, "AddLineNumbers");
Assert.AreEqual("2", result);
VB.NETCopy Code
Dim result As String
Dim ci As New CommandInterpreter(DefaultCommands.None, New TestCommands(), GetType(StaticTestFilter))
Assert.AreEqual(1, ci.Filters.Length)
Assert.AreEqual("AddLineNumbers", ci.Filters(0).DisplayName)

result = Capture(ci, "Count 2 /linenumbers")
Assert.AreEqual("1: 1" & vbCr & vbLf & "2: 2", result)

Dim cmds As Integer = ci.Commands.Length
ci.AddCommand(ci.Filters(0))
Assert.AreEqual(cmds + 1, ci.Commands.Length)

result = Capture(ci, "AddLineNumbers")
Assert.AreEqual("2", result)

Requirements

Target Platforms: Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7

See Also

Generated with Document! X 2011 by Innovasys