public void Validate1MoreArgsTest(bool valid) { DefArgs defArgs = new DefArgs(); Arg newArg = new Arg("", true, 0, !valid); defArgs.Add(newArg, false); Assert.AreEqual(valid, defArgs.Validate(valid ? new string[] { } : new[] { "abc" })); }
public void Add1Test(string name, bool required, int anzRequired, bool moreAllowed) { DefArgs defArgs = new DefArgs(); Arg newArg = new Arg(name, required, (uint)anzRequired, moreAllowed); defArgs.Add(newArg, false); Assert.IsTrue(defArgs.Args.Contains(newArg)); }
public void Validate1KeyTest(bool valid) { DefArgs defArgs = new DefArgs(); Arg newArg = new Arg(valid ? "" : "p", true, 0, false); defArgs.Add(newArg, false); Assert.AreEqual(valid, defArgs.Validate(new string[] { })); }
public void Validate1RequiredTest(bool valid) { DefArgs defArgs = new DefArgs(); Arg newArg = new Arg("p", !valid, 0, false); defArgs.Add(newArg, false); Assert.AreEqual(valid, defArgs.Validate(new string[] { })); }
public void Validate2RequiredTest(bool valid) { DefArgs defArgs = new DefArgs(); Arg newArg = new Arg("p", !valid, 0, false); defArgs.Add(newArg, false); IArgDictionary<string, string[]> args = new ArgDictionary<string, string[]>(); args.Add("", new string[] { }); Assert.AreEqual(valid, defArgs.Validate(args)); }
public void Validate2NumArgsTest(bool valid) { DefArgs defArgs = new DefArgs(); Arg newArg = new Arg("", true, 0, false); defArgs.Add(newArg, false); IArgDictionary<string,string[]> args = new ArgDictionary<string, string[]>(); args.Add("", valid ? new string[] { } : new[] { "abc" }); Assert.AreEqual(valid, defArgs.Validate(args)); }
public void Remove(Arg newArg) { if(newArg.Equals(null)) throw new ArgumentNullException(); if (_mArgs.Contains(newArg)) _mArgs.Remove(newArg); if (IsPrioritizedArg(newArg)) _mProritziedArgs.Remove(newArg); }
public bool IsPrioritizedArg(Arg newArg) { return _mProritziedArgs.Contains(newArg); }
public void Add(Arg newArg, bool overruleValidation = false) { if(newArg.Equals(null)) throw new ArgumentNullException(); if(!_mArgs.Any(t=>t.Name.Equals(newArg.Name))) _mArgs.Add(newArg); if (overruleValidation) _mProritziedArgs.Add(newArg); }