public void Guess(string name1, string name2, string name3, string @short, string @long, string abbr, int count) { var names = OptionNames.Guess(name1, name2, name3); Assert.That(names.Count, Is.EqualTo(count)); if (@short is string sn) { Assert.That(names.ShortName, Is.EqualTo(ShortOptionName.Parse(sn[0]))); } if (@long is string ln) { Assert.That(names.LongName, Is.EqualTo(ln)); } if (abbr is string an) { Assert.That(names.AbbreviatedName, Is.EqualTo(an)); } }
public void Parse(string s, string shortName, string longName, string abbreviatedName, bool isFlag, bool isNegatable, bool isValueOptional, string valueName, string description) { var spec = OptionSpec.Parse(s); if (shortName?.Length > 0) { Assert.That(spec.Names.ShortName, Is.EqualTo(ShortOptionName.Parse(shortName[0]))); } Assert.That(spec.Names.LongName, Is.EqualTo(longName)); Assert.That(spec.Names.AbbreviatedName, Is.EqualTo(abbreviatedName)); Assert.That(spec.IsFlag, Is.EqualTo(isFlag)); Assert.That(spec.IsLongNameNegatable, Is.EqualTo(isNegatable)); Assert.That(spec.IsValueOptional, Is.EqualTo(isValueOptional)); Assert.That(spec.ValueName, Is.EqualTo(valueName)); Assert.That(spec.Description, Is.EqualTo(description)); }