public void CannotParseUndefinedParameter() { var parameter = new OrderedEnumConsoleParameter <Verb>(() => Program.v, ""); bool mapped = parameter.PerformMapping(new LinkedList <string>("dfdsfdsf -aaa asdfsad -b -v -bbb sdfasdf".Split(' '))); Assert.AreEqual(Verb.Null, Program.v); Assert.IsFalse(mapped); }
public void CanParseWithOtherArgs() { var parameter = new OrderedEnumConsoleParameter <Verb>(() => Program.v, ""); bool mapped = parameter.PerformMapping(new LinkedList <string>("get -aaa asdfsad -b -v -bbb sdfasdf".Split(' '))); Assert.AreEqual(Verb.Get, Program.v); Assert.IsTrue(mapped); }
public void NotPresentDoesNotMap() { var parameter = new OrderedEnumConsoleParameter <Verb>(() => Program.v, ""); bool mapped = parameter.PerformMapping(new LinkedList <string>("".Split(' '))); Assert.AreEqual(Verb.Null, Program.v); Assert.IsFalse(mapped); }
public void CanParseValidValue() { var parameter = new OrderedEnumConsoleParameter <Verb>(() => Program.v, ""); bool mapped = parameter.PerformMapping(new LinkedList <string>("get".Split(' '))); Assert.AreEqual(Verb.Get, Program.v); Assert.IsTrue(mapped); }
public void ArgsRemovedOnSuccess() { var parameter = new OrderedEnumConsoleParameter <Verb>(() => Program.v, ""); var args = new LinkedList <string>("get -b -g".Split(' ')); bool mapped = parameter.PerformMapping(args);; Assert.AreEqual(Verb.Get, Program.v); Assert.IsTrue(mapped); Assert.AreEqual(2, args.Count); Assert.IsFalse(args.Contains("get")); }
public void ToStringText() { var parameter = new OrderedEnumConsoleParameter <Verb>(() => Program.v, "aaaa"); Assert.AreEqual("get, push : (Required) aaaa", parameter.ToString()); }