Skip to content

Commit

Permalink
Added unit tests for async extension methods
Browse files Browse the repository at this point in the history
  • Loading branch information
joseangelmt committed Feb 6, 2020
1 parent b938939 commit 4d25d14
Showing 1 changed file with 0 additions and 74 deletions.
74 changes: 0 additions & 74 deletions tests/CommandLine.Tests/Unit/ParserResultExtensionsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -161,15 +161,6 @@ public static void Turn_sucessful_parsing_into_exit_code()
0.Should().Be(expected);
}

[Fact]
public static async Task Turn_sucessful_parsing_into_exit_codeAsync()
{
var expected = await Parser.Default.ParseArguments<Simple_Options>(new[] { "--stringvalue", "value" })
.MapResultAsync(_ => Task.FromResult(0), _ => Task.FromResult(-1));

0.Should().Be(expected);
}

[Fact]
public static void Turn_sucessful_parsing_into_exit_code_for_verbs()
{
Expand All @@ -184,20 +175,6 @@ public static void Turn_sucessful_parsing_into_exit_code_for_verbs()
2.Should().Be(expected);
}

[Fact]
public static async Task Turn_sucessful_parsing_into_exit_code_for_verbsAsync()
{
var expected = await Parser.Default.ParseArguments<Add_Verb, Commit_Verb, Clone_Verb>(
new[] { "clone", "https://value.org/user/file.git" })
.MapResultAsync(
(Add_Verb opts) => Task.FromResult(0),
(Commit_Verb opts) => Task.FromResult(1),
(Clone_Verb opts) => Task.FromResult(2),
errs => Task.FromResult(3));

2.Should().Be(expected);
}

[Fact]
public static void Turn_failed_parsing_into_exit_code()
{
Expand All @@ -207,15 +184,6 @@ public static void Turn_failed_parsing_into_exit_code()
(-1).Should().Be(expected);
}

[Fact]
public static async Task Turn_failed_parsing_into_exit_codeAsync()
{
var expected = await Parser.Default.ParseArguments<Simple_Options>(new[] { "-i", "aaa" })
.MapResultAsync(_ => Task.FromResult(0), _ => Task.FromResult(-1));

(-1).Should().Be(expected);
}

[Fact]
public static void Turn_failed_parsing_into_exit_code_for_verbs()
{
Expand All @@ -230,20 +198,6 @@ public static void Turn_failed_parsing_into_exit_code_for_verbs()
3.Should().Be(expected);
}

[Fact]
public static async Task Turn_failed_parsing_into_exit_code_for_verbsAsync()
{
var expected = await Parser.Default.ParseArguments<Add_Verb, Commit_Verb, Clone_Verb>(
new[] { "undefined", "-xyz" })
.MapResultAsync(
(Add_Verb opts) => Task.FromResult(0),
(Commit_Verb opts) => Task.FromResult(1),
(Clone_Verb opts) => Task.FromResult(2),
errs => Task.FromResult(3));

3.Should().Be(expected);
}

[Fact]
public static void Invoke_parsed_lambda_when_parsed_for_base_verbs()
{
Expand Down Expand Up @@ -285,18 +239,6 @@ public static void Turn_sucessful_parsing_into_exit_code_for_single_base_verbs()
1.Should().Be(expected);
}

[Fact]
public static async Task Turn_sucessful_parsing_into_exit_code_for_single_base_verbsAsync()
{
var expected = await Parser.Default.ParseArguments<Add_Verb, Commit_Verb, Clone_Verb, Derived_Verb>(
new[] { "derivedadd", "dummy.bin" })
.MapResultAsync(
(Base_Class_For_Verb opts) => Task.FromResult(1),
errs => Task.FromResult(2));

1.Should().Be(expected);
}

[Fact]
public static void Turn_sucessful_parsing_into_exit_code_for_multiple_base_verbs()
{
Expand All @@ -312,21 +254,5 @@ public static void Turn_sucessful_parsing_into_exit_code_for_multiple_base_verbs

4.Should().Be(expected);
}

[Fact]
public static async Task Turn_sucessful_parsing_into_exit_code_for_multiple_base_verbsAsync()
{
var expected = await Parser.Default.ParseArguments<Add_Verb, Commit_Verb, Clone_Verb, Derived_Verb>(
new[] { "derivedadd", "dummy.bin" })
.MapResultAsync(
(Add_Verb opts) => Task.FromResult(0),
(Commit_Verb opts) => Task.FromResult(1),
(Clone_Verb opts) => Task.FromResult(2),
(Base_Class_For_Verb opts) => Task.FromResult(4),
(Derived_Verb opts) => Task.FromResult(3),
errs => Task.FromResult(5));

4.Should().Be(expected);
}
}
}

0 comments on commit 4d25d14

Please sign in to comment.