Beispiel #1
0
 public override bool SameItem(CliDefinitionItem definitionItem)
 {
     return(definitionItem.IsSwitchOrScalar &&
            (!string.IsNullOrEmpty(Name) && Name == definitionItem.Option ||
             !string.IsNullOrEmpty(ShortName) && ShortName == definitionItem.Option ||
             !string.IsNullOrEmpty(ShortName) && !string.IsNullOrEmpty(Name) &&
             Name + "|" + ShortName == definitionItem.Option));
 }
Beispiel #2
0
        public void IsSame(bool same, string itemText, string verb, string option, string valueName)
        {
            var definitionItem = new CliDefinitionItem()
            {
                Verb      = verb,
                ValueName = valueName,
                Option    = option
            };
            var result = ParsedDefinition.ParseItems(itemText).First();

            Assert.Equal(same, result.SameItem(definitionItem));
        }
Beispiel #3
0
        public void CliDefinitionItem_ToString(
            string verb, string option, string valueName, string propName, string helpText,
            string expectedText)
        {
            var obj = new CliDefinitionItem()
            {
                Verb         = verb,
                Option       = option,
                ValueName    = valueName,
                HelpText     = helpText,
                PropertyName = propName
            };
            var text = obj.ToString();

            Assert.Equal(expectedText, text);
        }
Beispiel #4
0
 public override bool SameItem(CliDefinitionItem definitionItem)
 {
     return(definitionItem.IsValueOption && ValueName == definitionItem.ValueName);
 }
Beispiel #5
0
 /// <summary>
 /// Check if definitionIten describes the same item. Eg. switch with the same name or the same verb.
 /// </summary>
 /// <param name="definitionItem"></param>
 /// <returns>If item is the same definition type and name</returns>
 public abstract bool SameItem(CliDefinitionItem definitionItem);
Beispiel #6
0
 public override bool SameItem(CliDefinitionItem definitionItem)
 {
     return(definitionItem.IsVerb && Name == definitionItem.Verb);
 }