示例#1
0
        [Test] public void AddOneOptionalArgument()
        {
            var actionContainer = new ActionContainer();
            Action res = actionContainer.AddArgument(new Argument("-e", "--example"));

            CollectionAssert.AreEquivalent(new[] {"-e", "--example"},
                ((IActionContainer) actionContainer).OptionStringActions.Keys);

            Assert.That(res, Is.InstanceOf<StoreAction>());
            Asserter.AreEqual(
                new StoreAction(new Argument("-e", "--example") {Destination = "example"}, actionContainer)
                ,
                res);
        }
示例#2
0
        [Test] public void AddOneOptionalArgumentWithActionName()
        {
            var actionContainer = new ActionContainer();
            var argument = new Argument("-e", "--example")
            {
                ActionName = "count"
            };
            var argumentCopy = new Argument(argument);
            argumentCopy.Destination = "example";
            Action res =
                actionContainer.AddArgument(argument);

            CollectionAssert.AreEquivalent(new[] {"-e", "--example"}, argument.OptionStrings);

            Assert.That(res, Is.InstanceOf<CountAction>());
            Asserter.AreEqual(
                new CountAction(argumentCopy, actionContainer),
                res);
        }