BadScript 2
Loading...
Searching...
No Matches
NameLookupTests.cs
Go to the documentation of this file.
1// Copyright 2005-2015 Giacomo Stelluti Scala & Contributors. All rights reserved. See License.md in the project root for license information.
2
3using System;
4using System.Collections.Generic;
5using Xunit;
6using FluentAssertions;
8using CSharpx;
9
11{
12 public class NameLookupTests
13 {
14 [Fact]
16 {
17 // Fixture setup
18 var expected = Maybe.Just(".");
19 var specs = new[] { new OptionSpecification(string.Empty, "string-seq",
20 false, string.Empty, Maybe.Nothing<int>(), Maybe.Nothing<int>(), '.', null, string.Empty, string.Empty, new List<string>(), typeof(IEnumerable<string>), TargetType.Sequence, string.Empty)};
21
22 // Exercize system
23 var result = NameLookup.HavingSeparator("string-seq", specs, StringComparer.Ordinal);
24 // Verify outcome
25 expected.Should().BeEquivalentTo(result);
26
27 // Teardown
28 }
29
30 [Fact]
32 {
33 const string ShortName = "s";
34 const string LongName = "long";
35
36 // Fixture setup
37 var expected = new NameInfo(ShortName, LongName);
38 var spec = new OptionSpecification(ShortName, LongName, false, string.Empty, Maybe.Nothing<int>(), Maybe.Nothing<int>(), '.', null, string.Empty, string.Empty, new List<string>(), typeof(IEnumerable<string>), TargetType.Sequence, string.Empty);
39
40 // Exercize system
41 var result = spec.FromOptionSpecification();
42
43 // Verify outcome
44 expected.Should().BeEquivalentTo(result);
45
46 // Teardown
47 }
48
49 }
50}
The Maybe type models an optional value. A value of type Maybe a either contains a value of type a (r...
Definition Maybe.cs:33
static Maybe< char > HavingSeparator(string name, IEnumerable< OptionSpecification > specifications, StringComparer comparer)
Definition NameLookup.cs:37
Models name information, used in CommandLine.Error instances.
Definition NameInfo.cs:11