CSharpTest.Net
Set(String,Object) Method
See Also  Example Send Feedback Download Help File
CSharpTest.Net.Library Assembly > CSharpTest.Net.Commands Namespace > CommandInterpreter Class > Set Method : Set(String,Object) Method

property
value

Glossary Item Box

Command to set the value of an option

Syntax

Visual Basic (Declaration) 
Public Overloads Sub Set( _
   ByVal property As String, _
   ByVal value As Object _
) 
C# 
public void Set( 
   string property,
   object value
)

Parameters

property
value

Example

Library/Library.Test/TestCmdInterpreter.cs

C#Copy Code
string result;
CommandInterpreter ci = new CommandInterpreter(DefaultCommands.Echo | DefaultCommands.Prompt, new TestCommands());

ci.Set("SomeData", "TEST_Data");
result = Capture(ci, "ECHO $(SOMEDATA)");
Assert.AreEqual("TEST_Data", result);

ci.Set("SomeData", "TEST Data");
result = Capture(ci, "ECHO $(SOMEDATA)");
Assert.AreEqual("\"TEST Data\"", result); // <= Echo will quote & escape while-space and quotes "

result = Capture(ci, "ECHO $(MissingProperty)");
Assert.AreEqual("Unknown option specified: MissingProperty", result);

result = Capture(ci, "ECHO (MissingProperty) (xx xy  abc"); // <= escape '$' with ''
Assert.AreEqual("$(MissingProperty) $(xx x$y $ abc", result)
' <= extra '$' was removed.

Requirements

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

See Also

Generated with Document! X 2011 by Innovasys