Visual Basic (Declaration) | |
---|---|
Public Overloads Sub Set( _ ByVal property As String, _ ByVal value As Object _ ) |
Parameters
- property
- value
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. |
Target Platforms: Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7