Skip to content

Commit 8bfeec7

Browse files
committed
1.5.0
1 parent 0446dd6 commit 8bfeec7

File tree

8 files changed

+15
-18
lines changed

8 files changed

+15
-18
lines changed

GithubBackup.Cli.Tests.Integration/Commands/Github/Login/LoginTests.RunAsync_LoginUsingToken_ThrowsException.verified.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

GithubBackup.Cli.Tests.Integration/Commands/Github/Login/LoginTests.RunAsync_LoginUsing_.verified.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

GithubBackup.Cli.Tests.Integration/Commands/Github/Login/LoginTests.RunAsync___args=login --token test_token.verified.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

GithubBackup.Cli.Tests.Integration/Commands/Github/Login/LoginTests.RunAsync___args=login.verified.txt

Lines changed: 0 additions & 12 deletions
This file was deleted.

GithubBackup.Cli.Tests.Integration/Commands/Github/Login/LoginTests.cs

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using GithubBackup.Core.Github.Users;
1+
using AwesomeAssertions;
2+
using GithubBackup.Core.Github.Users;
23

34
namespace GithubBackup.Cli.Tests.Integration.Commands.Github.Login;
45

@@ -9,7 +10,15 @@ public class LoginTests
910
[InlineData("login", 1)]
1011
public async Task RunAsync__(string args, int exitCode = 0)
1112
{
12-
await TestCli.RunAsync(args, exitCode, _ => { });
13+
var action = () => TestCli.RunAsync(args, exitCode, _ => { });
14+
if (exitCode == 0)
15+
{
16+
await action();
17+
}
18+
else
19+
{
20+
await action.Should().ThrowAsync<Exception>().WithMessage("Login failed");
21+
}
1322
}
1423

1524
[Fact(Skip = "Not yet implemented")]
@@ -48,4 +57,4 @@ params KeyValuePair<string, string>[] headers
4857

4958
return allHeaders;
5059
}
51-
}
60+
}

GithubBackup.Cli.Tests.Integration/TestCli.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ public static async Task RunAsync(
3939
args.Split(" "),
4040
new CliOptions
4141
{
42+
EnableDefaultExceptionHandler = false,
4243
Output = testConsole.Profile.Out.Writer,
4344
Error = testConsole.Profile.Out.Writer,
4445
AfterServices = hb => hb.Services.AddSingleton<IFileSystem>(mockFileSystem),

GithubBackup.Cli/Boot/Cli.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ public static Task<int> RunAsync(string[] args, CliOptions? options = null)
2828

2929
return rootCommand.Parse(args).InvokeAsync(new InvocationConfiguration
3030
{
31+
EnableDefaultExceptionHandler = cliOptions.EnableDefaultExceptionHandler,
3132
Output = cliOptions.Output,
3233
Error = cliOptions.Error
3334
});

GithubBackup.Cli/Boot/CliOptions.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ namespace GithubBackup.Cli.Boot;
55

66
public class CliOptions
77
{
8+
public bool EnableDefaultExceptionHandler { get; set; } = true;
89
public TextWriter Output { get; init; } = AnsiConsole.Profile.Out.Writer;
910
public TextWriter Error { get; init; } = AnsiConsole.Profile.Out.Writer;
1011
public Action<HostApplicationBuilder> AfterServices { get; init; } = _ => { };

0 commit comments

Comments
 (0)