4using System.Collections.Generic;
18 var expectedSequence =
new[]
20 new KeyValuePair<string, IEnumerable<string>>(
"i",
new[] {
"10",
"20",
"30",
"40"})
24 new OptionSpecification(
string.Empty,
"stringvalue",
false,
string.Empty,
Maybe.Nothing<
int>(),
Maybe.Nothing<
int>(),
'\0',
null,
string.Empty,
string.Empty,
new List<string>(), typeof(
string),
TargetType.Scalar,
string.Empty),
25 new OptionSpecification(
"i",
string.Empty,
false,
string.Empty,
Maybe.Just(3),
Maybe.Just(4),
'\0',
null,
string.Empty,
string.Empty,
new List<string>(), typeof(IEnumerable<int>),
TargetType.Sequence,
string.Empty)
35 var options = result.Item1;
36 Assert.True(expectedSequence.All(a => options.Any(r => a.Key.Equals(r.Key) && a.Value.SequenceEqual(r.Value))));
45 var expectedSequence =
new[]
47 new KeyValuePair<string, IEnumerable<string>>(
"i",
new[] {
"10",
"10",
"30",
"40"})
51 new OptionSpecification(
string.Empty,
"stringvalue",
false,
string.Empty,
Maybe.Nothing<
int>(),
Maybe.Nothing<
int>(),
'\0',
null,
string.Empty,
string.Empty,
new List<string>(), typeof(
string),
TargetType.Scalar,
string.Empty),
52 new OptionSpecification(
"i",
string.Empty,
false,
string.Empty,
Maybe.Just(3),
Maybe.Just(4),
'\0',
null,
string.Empty,
string.Empty,
new List<string>(), typeof(IEnumerable<int>),
TargetType.Sequence,
string.Empty)
62 var options = result.Item1;
63 Assert.True(expectedSequence.All(a => options.Any(r => a.Key.Equals(r.Key) && a.Value.SequenceEqual(r.Value))));
The Maybe type models an optional value. A value of type Maybe a either contains a value of type a (r...
static Token Value(string text)
static Token Name(string text)
static Tuple< IEnumerable< KeyValuePair< string, IEnumerable< string > > >, IEnumerable< string >, IEnumerable< Token > > Partition(IEnumerable< Token > tokens, Func< string, Maybe< TypeDescriptor > > typeLookup)
static Maybe< TypeDescriptor > FindTypeDescriptorAndSibling(string name, IEnumerable< OptionSpecification > specifications, StringComparer comparer)
void Partition_sequence_returns_sequence()
void Partition_sequence_returns_sequence_with_duplicates()