Esempio n. 1
0
 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" }));
 }
Esempio n. 2
0
 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));
 }
Esempio n. 3
0
 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[] { }));
 }
Esempio n. 4
0
 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[] { }));
 }
Esempio n. 5
0
 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));
 }
Esempio n. 6
0
 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));
 }
Esempio n. 7
0
 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);
 }
Esempio n. 8
0
 public bool IsPrioritizedArg(Arg newArg)
 {
     return _mProritziedArgs.Contains(newArg);
 }
Esempio n. 9
0
 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);
 }