public void TestEnumAllowedOut() { var p = new CmdArgsParser <ConfEnumAllowed>(); Assert.Throws <CmdException>( () => p.ParseCommandLine(new[] { "-a", "2" })); }
public void TestWrongFieldType() { var p = new CmdArgsParser <ConfWrongFieldType>(); Assert.Throws <ConfException>(() => p.ParseCommandLine(new[] { "-f", "./sadf" })); }
public void TestFileOk() { var p = new CmdArgsParser <ConfFile>(); Res <ConfFile> res = p.ParseCommandLine(new[] { "-f", "./asdf" }); Assert.AreEqual("asdf", res.Args.File.Name); }
public void TestLongEmptyName() { var p = new CmdArgsParser <ConfOkOne>(); Assert.Throws <CmdException>(() => p.ParseCommandLine(new[] { "--DEFINE=val" })); }
public void TestFileDefaultValueOk() { var p = new CmdArgsParser <ConfFileDefaultValue>(); Res <ConfFileDefaultValue> r = p.ParseCommandLine(new[] { "-f" }); Assert.AreEqual("prog.conf", r.Args.File.Name); }
public void TestAllowedByPredicate() { var p = new CmdArgsParser <ConfAllowedByPredicate>(); Assert.Throws <ConfException>(() => p.ParseCommandLine(new[] { "-p", "1:3" })); }
public void TestBadSign() { var p = new CmdArgsParser <ConfBadSign>(); Assert.Throws <ConfException>(() => p.ParseCommandLine(new[] { "-p", "23:64" })); }
public void TestRegexIntOk() { var p = new CmdArgsParser <ConfRegexInt>(); Res <ConfRegexInt> res = p.ParseCommandLine(new[] { "-b", "208" }); Assert.AreEqual(208, res.Args.B); }
public void TestRegexIntBad() { var p = new CmdArgsParser <ConfRegexInt>(); Assert.Throws <CmdException>(() => p.ParseCommandLine(new[] { "-b", "218" })); }
public void TestPredicateBadTypeAr() { var p = new CmdArgsParser <ConfPredicateBadTypeAr>(); Assert.Throws <ConfException>(() => p.ParseCommandLine(new[] { "-b", "25" })); }
public void TestRegexOk() { var p = new CmdArgsParser <ConfRegex>(); Res <ConfRegex> res = p.ParseCommandLine(new[] { "-b", "bB1" }); Assert.AreEqual("bB1", res.Args.B); }
public void TestPredicateArArBadOne() { var p = new CmdArgsParser <ConfPredicateArAr>(); Assert.Throws <CmdException>(() => p.ParseCommandLine(new[] { "-b", "25", "1", "12" })); }
public void TestAllowedBadAllowedByRegex() { var p = new CmdArgsParser <ConfAllowedBadAllowedByRegex>(); Assert.Throws <ConfException>(() => p.ParseCommandLine(new[] { "-b" })); }
public void TestBadDefaultByAllowed() { var p = new CmdArgsParser <ConfBadDefaultByAllowed>(); Assert.Throws <ConfException>(() => p.ParseCommandLine(new[] { "-b" })); }
public void TestDefNotAllowed() { var p = new CmdArgsParser <ConfDefNotAllowed>(); Assert.Throws <ConfException>(() => p.ParseCommandLine(new[] { "-p", "1:3" })); }
public void TestDefErrorUsenoarg() { var p = new CmdArgsParser <ConfDefErrorUsenoarg>(); Assert.Throws <ConfException>(() => p.ParseCommandLine(new[] { "--deftrue" })); }
public void TestDefarrayPredicate() { var p = new CmdArgsParser <ConfDefarrayPredicate>(); Assert.Throws <ConfException>(() => p.ParseCommandLine(new[] { "-p" })); }
public void TestNegative() { var p = new CmdArgsParser <Conf>(); Res <Conf> rv = p.ParseCommandLine(new[] { "-s", "-1" }); Assert.AreEqual(actual: rv.Args.Some, expected: -1); }
public void TestCantDeser() { var p = new CmdArgsParser <ConfCantDeser>(); Assert.Throws <CmdException>(() => p.ParseCommandLine(new[] { "-p", "13" })); }
public void TestIntLongVal() { var p = new CmdArgsParser <Conf>(); Res <Conf> rv = p.ParseCommandLine(new[] { "-d", "11" }); Assert.AreEqual(11L, rv.Args.Dummy); }
public void TestOnlyEq() { var p = new CmdArgsParser <ConfOkOne>(); Assert.Throws <CmdException>(() => p.ParseCommandLine(new[] { "-D=" })); }
public void TestChar() { var p = new CmdArgsParser <ConfChar>(); Res <ConfChar> rv = p.ParseCommandLine(new[] { "-c", "u" }); Assert.AreEqual(actual: rv.Args.C, expected: 'u'); }
public void TestFileNotExists() { var p = new CmdArgsParser <ConfFileEx>(); Assert.Throws <CmdException>( () => p.ParseCommandLine(new[] { "-f", "./asdf" })); }
public void TestStringSpacesEquality() { var p = new CmdArgsParser <ConfString>(); Res <ConfString> rv = p.ParseCommandLine(new[] { "-s=value with value" }); Assert.AreEqual("value with value", rv.Args.S); }
public void TestFileAllowedValuesBadType() { var p = new CmdArgsParser <ConfFileAllowedValuesBadType>(); Assert.Throws <ConfException>(() => p.ParseCommandLine(new[] { "-f", "./asdf" })); }
public void TestDirWrongUrl() { var p = new CmdArgsParser <ConfDir>(); Assert.Throws <CmdException>(() => p.ParseCommandLine(new[] { "-f", "./asdf:asdf" })); }
public void TestWrongArgType() { var p = new CmdArgsParser <ConfWrongArgType>(); Assert.Throws <ConfException>(() => p.ParseCommandLine(new string[] { })); }
public void TestDirDefaultValueOk() { var p = new CmdArgsParser <ConfDirDefaultValue>(); Res <ConfDirDefaultValue> r = p.ParseCommandLine(new[] { "-f" }); Assert.AreEqual("somename", r.Args.Dir.Name); }
public void TestFileWrongUrl1() { var p = new CmdArgsParser <ConfFile>(); Assert.Throws <CmdException>(() => p.ParseCommandLine(new[] { "-f", "./asdf\"" })); }
public void TestEnumAllowedOk() { var p = new CmdArgsParser <ConfEnumAllowed>(); Res <ConfEnumAllowed> res = p.ParseCommandLine(new[] { "-a", "3" }); Assert.AreEqual(Constraint.Three, res.Args.A); }