4using System.Collections.Generic;
44 return specification.ShortName.Length > 0 ? specification.ShortName : specification.
LongName;
47 public static IEnumerable<Specification>
ThrowingValidate(
this IEnumerable<Specification> specifications,
48 IEnumerable<Tuple<Func<Specification, bool>,
string>>
51 foreach (Tuple<Func<Specification, bool>,
string> guard
in guardsLookup)
53 if (specifications.Any(spec => guard.Item1(spec)))
55 throw new InvalidOperationException(guard.Item2);
59 return specifications;
67 if (specification.
Min.MatchJust(out min) && specification.
Max.MatchJust(out max))
69 return predicate(min, max);
79 if (specification.
Min.MatchJust(out min))
81 return predicate(min);
91 if (specification.
Max.MatchJust(out max))
93 return predicate(max);
bool FlagCounter
Whether this is an int option that counts how many times a flag was set rather than taking a value on...
static string UniqueName(this OptionSpecification specification)
static bool HavingMin(this Specification specification, Func< int, bool > predicate)
static bool IsOption(this Specification specification)
static IEnumerable< Specification > ThrowingValidate(this IEnumerable< Specification > specifications, IEnumerable< Tuple< Func< Specification, bool >, string > > guardsLookup)
static OptionSpecification WithLongName(this OptionSpecification specification, string newLongName)
static bool HavingMax(this Specification specification, Func< int, bool > predicate)
static bool IsValue(this Specification specification)
static bool HavingRange(this Specification specification, Func< int, int, bool > predicate)
Maybe< object > DefaultValue
Type ConversionType
This information is denormalized to decouple Specification from PropertyInfo.
IEnumerable< string > EnumValues