本文整理汇总了C#中System.Switch.GetArgumentValues方法的典型用法代码示例。如果您正苦于以下问题:C# Switch.GetArgumentValues方法的具体用法?C# Switch.GetArgumentValues怎么用?C# Switch.GetArgumentValues使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Switch
的用法示例。
在下文中一共展示了Switch.GetArgumentValues方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddArgumentValue
public void AddArgumentValue()
{
const string ArgumentValue1 = "value1";
const string ArgumentValue2 = "value2";
string[] argumentNames = new string[] { "arg1", "arg2" };
string[] argumentValues1 = new string[] { ArgumentValue1 };
string[] argumentValues2 = new string[] { ArgumentValue1, ArgumentValue2 };
Switch switchObject = new Switch(Name, LongName, Description,
IsRequired, argumentNames);
// Add first argument value.
switchObject.AddArgumentValue(ArgumentValue1);
Assert.AreEqual(argumentNames, switchObject.GetArgumentNames());
Assert.AreEqual(argumentValues1, switchObject.GetArgumentValues());
Assert.AreEqual(argumentNames.Length, switchObject.NumberArguments);
Assert.IsFalse(switchObject.HasEnoughValues);
Assert.IsTrue(switchObject.HasArguments);
Assert.IsTrue(switchObject.HasEnoughNames);
// Add second argument value.
switchObject.AddArgumentValue(ArgumentValue2);
Assert.AreEqual(argumentNames, switchObject.GetArgumentNames());
Assert.AreEqual(argumentValues2, switchObject.GetArgumentValues());
Assert.AreEqual(argumentNames.Length, switchObject.NumberArguments);
Assert.IsTrue(switchObject.HasArguments);
Assert.IsTrue(switchObject.HasEnoughNames);
Assert.IsTrue(switchObject.HasEnoughValues);
}
示例2: WithSameNames
public void WithSameNames()
{
Switch switchObject = new Switch(Name, Name, Description);
Assert.AreEqual(Description, switchObject.Description);
Assert.AreEqual(NoArgumentNames, switchObject.GetArgumentNames());
Assert.AreEqual(NoArgumentValues, switchObject.GetArgumentValues());
Assert.AreEqual(Name, switchObject.Name);
Assert.AreEqual(NoArguments, switchObject.NumberArguments);
Assert.AreNotEqual(Name, switchObject.LongName);
Assert.IsFalse(switchObject.HasArguments);
Assert.IsFalse(switchObject.HasEnoughNames);
Assert.IsFalse(switchObject.HasEnoughValues);
Assert.IsFalse(switchObject.HasLongName);
Assert.IsFalse(switchObject.IsRequired);
Assert.IsNotNull(switchObject.Description);
Assert.IsNotNull(switchObject.Name);
Assert.IsNull(switchObject.LongName);
Assert.IsTrue(switchObject.HasDescription);
Assert.IsTrue(switchObject.IsOptional);
}
示例3: WithArgumentsName
public void WithArgumentsName()
{
const string ArgumentName = "args";
Switch switchObject = new Switch(Name, LongName, Description,
HasArguments, IsRequired, ArgumentName);
Assert.AreEqual(Description, switchObject.Description);
Assert.AreEqual(new string[] { ArgumentName }, switchObject.GetArgumentNames());
Assert.AreEqual(NoArgumentValues, switchObject.GetArgumentValues());
Assert.AreEqual(LongName, switchObject.LongName);
Assert.AreEqual(Name, switchObject.Name);
Assert.AreEqual(UnknownNumberArguments, switchObject.NumberArguments);
Assert.IsFalse(switchObject.HasEnoughValues);
Assert.IsFalse(switchObject.IsOptional);
Assert.IsNotNull(switchObject.Description);
Assert.IsNotNull(switchObject.LongName);
Assert.IsNotNull(switchObject.Name);
Assert.IsTrue(switchObject.HasArguments);
Assert.IsTrue(switchObject.HasDescription);
Assert.IsTrue(switchObject.HasEnoughNames);
Assert.IsTrue(switchObject.HasLongName);
Assert.IsTrue(switchObject.IsRequired);
}
示例4: WithNumberArgumentsNonPrintable
public void WithNumberArgumentsNonPrintable()
{
const int NumberArguments = 5;
Switch switchObject = new Switch(Name, NumberArguments);
Assert.AreEqual(NoArgumentNames, switchObject.GetArgumentNames());
Assert.AreEqual(NoArgumentValues, switchObject.GetArgumentValues());
Assert.AreEqual(Name, switchObject.Name);
Assert.AreEqual(NumberArguments, switchObject.NumberArguments);
Assert.IsFalse(switchObject.HasDescription);
Assert.IsFalse(switchObject.HasEnoughNames);
Assert.IsFalse(switchObject.HasEnoughValues);
Assert.IsFalse(switchObject.HasLongName);
Assert.IsFalse(switchObject.IsRequired);
Assert.IsNotNull(switchObject.Name);
Assert.IsNull(switchObject.Description);
Assert.IsNull(switchObject.LongName);
Assert.IsTrue(switchObject.HasArguments);
Assert.IsTrue(switchObject.IsOptional);
}
示例5: WithArgumentNames
public void WithArgumentNames()
{
string[] argumentNames = new string[] { "arg1", "arg2", "arg3" };
Switch switchObject = new Switch(Name, LongName, Description,
IsRequired, argumentNames);
Assert.AreEqual(Description, switchObject.Description);
Assert.AreEqual(argumentNames, switchObject.GetArgumentNames());
Assert.AreEqual(NoArgumentValues, switchObject.GetArgumentValues());
Assert.AreEqual(LongName, switchObject.LongName);
Assert.AreEqual(Name, switchObject.Name);
Assert.AreEqual(argumentNames.Length, switchObject.NumberArguments);
Assert.IsFalse(switchObject.HasEnoughValues);
Assert.IsFalse(switchObject.IsOptional);
Assert.IsNotNull(switchObject.Description);
Assert.IsNotNull(switchObject.LongName);
Assert.IsNotNull(switchObject.Name);
Assert.IsTrue(switchObject.HasArguments);
Assert.IsTrue(switchObject.HasDescription);
Assert.IsTrue(switchObject.HasEnoughNames);
Assert.IsTrue(switchObject.HasLongName);
Assert.IsTrue(switchObject.IsRequired);
}