本文整理汇总了C#中Args.Has方法的典型用法代码示例。如果您正苦于以下问题:C# Args.Has方法的具体用法?C# Args.Has怎么用?C# Args.Has使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Args
的用法示例。
在下文中一共展示了Args.Has方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ExtraArgumentsThatLookLikeFlags
public void ExtraArgumentsThatLookLikeFlags()
{
var args = new Args("x,y", "-x", "alpha", "-y", "beta");
args.Has('x').ShouldBeTrue();
args.Has('y').ShouldBeFalse();
args.Get<bool>('x').ShouldBeTrue();
args.Get<bool>('y').ShouldBeFalse();
args.NextArgument().ShouldBe(1);
}
示例2: ExtraArguments
public void ExtraArguments()
{
var args = new Args("x,y*", "-x", "-y", "alpha", "beta");
args.Has('x').ShouldBeTrue();
args.Has('y').ShouldBeTrue();
args.Get<bool>('x').ShouldBeTrue();
args.Get<string>('y').ShouldBe("alpha");
args.NextArgument().ShouldBe(3);
}
示例3: SimpleIntPresent
public void SimpleIntPresent()
{
var args = new Args("x#", "-x", "42");
args.Has('x').ShouldBeTrue();
args.Get<int>('x').ShouldBe(42);
args.NextArgument().ShouldBe(2);
}
示例4: SimpleDoublePresent
public void SimpleDoublePresent()
{
var args = new Args("x##", new[] { "-x", "42.13" });
Assert.True(args.Has('x'));
Assert.AreEqual(42.13, args.GetDouble('x'));
Assert.AreEqual(1, args.Cardinality());
}
示例5: SimpleIntPresent
public void SimpleIntPresent()
{
var args = new Args("x#", new[] { "-x", "42" });
Assert.True(args.Has('x'));
Assert.AreEqual(42, args.GetInt('x'));
Assert.AreEqual(1, args.Cardinality());
}
示例6: SpacesInFormat
public void SpacesInFormat()
{
var args = new Args("x, y", new[] { "-xy" });
Assert.True(args.Has('x'));
Assert.True(args.Has('y'));
Assert.AreEqual(2, args.Cardinality());
}
示例7: SimpleStringPresent
public void SimpleStringPresent()
{
var args = new Args("x*", new[] { "-x", "param" });
Assert.True(args.Has('x'));
Assert.AreEqual("param", args.GetString('x'));
Assert.AreEqual(1, args.Cardinality());
}
示例8: SpacesInFormat
public void SpacesInFormat()
{
var args = new Args("x, y", "-xy");
args.Has('x').ShouldBeTrue();
args.Has('y').ShouldBeTrue();
args.NextArgument().ShouldBe(1);
}
示例9: SimpleStringPresent
public void SimpleStringPresent()
{
var args = new Args("x*", "-x", "param");
args.Has('x').ShouldBeTrue();
args.Get<string>('x').ShouldBe("param");
args.NextArgument().ShouldBe(2);
}
示例10: SimpleDoublePresent
public void SimpleDoublePresent()
{
var args = new Args("x##", "-x", "42.3");
args.Has('x').ShouldBeTrue();
args.Get<double>('x').ShouldBe(42.3);
}
示例11: StringArray
public void StringArray()
{
var args = new Args("x[*]", "-x", "alpha");
args.Has('x').ShouldBeTrue();
var result = args.Get<List<string>>('x');
result.Count.ShouldBe(1);
result[0].ShouldBe("alpha");
}