public void CanAssignMultipleFlags() { var parameter = new BooleanConsoleParameter(new[] { "b", "c" }, () => Program.b, ""); bool mapped1 = parameter.PerformMapping(new LinkedList <string>("-b".Split(' '))); Assert.IsTrue(Program.b); Assert.IsTrue(mapped1); bool mapped2 = parameter.PerformMapping(new LinkedList <string>("-c".Split(' '))); Assert.IsTrue(Program.b); Assert.IsTrue(mapped2); }
public void CanParseBoolLastParameter() { var parameter = new BooleanConsoleParameter(new[] { "b" }, () => Program.b, ""); bool mapped = parameter.PerformMapping(new LinkedList <string>("-aaa asdfsad -b".Split(' '))); Assert.IsTrue(Program.b); Assert.IsTrue(mapped); }
public void BoolNotPresentMapsTrue() { var parameter = new BooleanConsoleParameter(new[] { "b" }, () => Program.b, ""); bool mapped = parameter.PerformMapping(new LinkedList <string>("".Split(' '))); Assert.IsFalse(Program.b); Assert.IsTrue(mapped); }
public void ArgsRemovedOnSuccess() { var parameter = new BooleanConsoleParameter(new[] { "b" }, () => Program.b, ""); var args = new LinkedList <string>("-q -b -g".Split(' ')); bool mapped = parameter.PerformMapping(args);; Assert.IsTrue(Program.b); Assert.IsTrue(mapped); Assert.AreEqual(2, args.Count); Assert.IsFalse(args.Contains("-b")); }