本文整理汇总了C#中CommandLineArguments.ArgumentPassed方法的典型用法代码示例。如果您正苦于以下问题:C# CommandLineArguments.ArgumentPassed方法的具体用法?C# CommandLineArguments.ArgumentPassed怎么用?C# CommandLineArguments.ArgumentPassed使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CommandLineArguments
的用法示例。
在下文中一共展示了CommandLineArguments.ArgumentPassed方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ArgumentPassed_ArgumentPassed_CaseInsensitive
public void ArgumentPassed_ArgumentPassed_CaseInsensitive()
{
IEnumerable<string> args = @"/a /b /c".Split(' ');
CommandLineArguments target = new CommandLineArguments(args);
string[] expectedArgs = new string[] { "a", "A", "b", "B", "c", "C" };
bool expected = true;
bool actual;
foreach (string arg in expectedArgs)
{
actual = target.ArgumentPassed(arg);
Assert.AreEqual(expected, actual);
}
}
示例2: ArgumentPassed_ArgumentNotPassed_ReturnsFalse
public void ArgumentPassed_ArgumentNotPassed_ReturnsFalse()
{
IEnumerable<string> args = @"/a /b /c".Split(' ');
CommandLineArguments target = new CommandLineArguments(args);
string argument = "d";
bool expected = false;
bool actual = target.ArgumentPassed(argument);
Assert.AreEqual(expected, actual);
}
示例3: ArgumentPassed_ArgumentPassed_ReturnsFalseIfSlashIncluded
public void ArgumentPassed_ArgumentPassed_ReturnsFalseIfSlashIncluded()
{
IEnumerable<string> args = @"/a /b /c".Split(' ');
CommandLineArguments target = new CommandLineArguments(args);
string arg = @"/b"; //passed as argument, but when asking for it, slash should not be included
bool expected = false;
bool actual = target.ArgumentPassed(arg);
Assert.AreEqual(expected, actual);
}
示例4: ArgumentPassed_NoArguments_ReturnsFalse
public void ArgumentPassed_NoArguments_ReturnsFalse()
{
IEnumerable<string> args = null;
CommandLineArguments target = new CommandLineArguments(args);
string argument = "test";
bool expected = false;
bool actual = target.ArgumentPassed(argument);
Assert.AreEqual(expected, actual);
}