Пример #1
0
 /// <summary>
 /// Initializes a new instance of the Parameter class.
 /// </summary>
 /// <param name="syntaxAttribute"><see cref="ParameterSyntaxAttribute"/> providing information about the
 /// parameter.</param>
 /// <param name="argument">The argument provided to this parameter.</param>
 public Parameter(ParameterSyntaxAttribute syntaxAttribute, object argument)
 {
     this.Position = syntaxAttribute.Position;
     this.Required = syntaxAttribute.Required;
     this.Syntax   = syntaxAttribute.Syntax;
     this.Argument = argument;
 }
Пример #2
0
        public void ToString_TrueBoolArgumentWithoutValue_UsesDefaultBoolBehavior()
        {
            ParameterSyntaxAttribute attribute = new ParameterSyntaxAttribute("--param");
            Parameter target = new Parameter(attribute, true);

            string expected = "--param";
            string actual = target.ToString();

            Assert.AreEqual(expected, actual);
        }
Пример #3
0
        public void ToString_StringArgument_UsesDefaultStringBehavior()
        {
            ParameterSyntaxAttribute attribute = new ParameterSyntaxAttribute("--param {arg}");
            Parameter target = new Parameter(attribute, "argument");

            string expected = "--param argument";
            string actual = target.ToString();

            Assert.AreEqual(expected, actual);
        }
Пример #4
0
        public void ToString_IEnumerableArgumentWithTwoItems_UsesDefaultIEnumerableBehavior()
        {
            ParameterSyntaxAttribute attribute = new ParameterSyntaxAttribute("--param {arg}");
            IEnumerable argument = new string[] { "argument1", "argument2" };
            Parameter target = new Parameter(attribute, argument);

            string expected = "--param argument1 argument2";
            string actual = target.ToString();

            Assert.AreEqual(expected, actual);
        }