public void TestThatUsesSwitchIsParsed() { var options = new BasicOptionParser(); options.Parse("--required-option"); Assert.IsFalse(options.Usage.IsDefined); options.Parse("--required-option", "--help"); Assert.IsTrue(options.Usage.IsDefined); }
public void TestThatUsesSwitchBypassesOptionValidation() { var options = new BasicOptionParser(); options.Parse("--help"); Assert.IsTrue(options.Usage.IsDefined); }
public void TestThatShortNameParsesCorrectly() { var options = new BasicOptionParser(); options.Parse("-r"); Assert.IsTrue(options.MyRequiredOption.IsDefined); }
public void TestThatSwitchOverridesDefaultValue() { var options = new BasicOptionParser(); options.Parse("--required-option", "-i", "5"); Assert.IsTrue(options.MyIntOption.IsDefined); Assert.IsTrue(options.MyIntOption.Value == 5); }
public void TestThatDefaultValueIsUsed() { var options = new BasicOptionParser(); Assert.IsTrue(options.MyIntOption.DefaultValue == "3"); Assert.IsTrue(options.MyIntOption.Value == 3); options.Parse("--required-option"); Assert.IsFalse(options.MyIntOption.IsDefined); Assert.IsTrue(options.MyIntOption.Value == 3); }
public void TestForRequiredOptions() { var options = new BasicOptionParser(); Assert.ThrowsException <SyntaxErrorException>(() => options.Parse()); }
public void TestThatWrongArgumentStringThrowsException() { var options = new BasicOptionParser(); options.Parse("-i", bool.TrueString); }