Preparations for the 1.0 release

* Less cluttered solution layout.
* Move examples to a repository of its own.
* Move Roslyn analyzer to a repository of its own.
* Enable central package management.
* Clean up csproj files.
* Add README file to NuGet packages.
This commit is contained in:
Patrik Svensson
2024-08-05 20:41:45 +02:00
committed by Patrik Svensson
parent bb72b44d60
commit 42fd801876
677 changed files with 272 additions and 6214 deletions

View File

@ -0,0 +1,70 @@
namespace Spectre.Console.Tests.Unit.Cli;
public sealed partial class CommandAppTests
{
public sealed class Async
{
[Fact]
public async Task Should_Execute_Command_Asynchronously()
{
// Given
var app = new CommandAppTester();
app.SetDefaultCommand<AsynchronousCommand>();
app.Configure(config =>
{
config.PropagateExceptions();
});
// When
var result = await app.RunAsync();
// Then
result.ExitCode.ShouldBe(0);
result.Output.ShouldBe("Finished executing asynchronously");
}
[Fact]
public async Task Should_Handle_Exception_Asynchronously()
{
// Given
var app = new CommandAppTester();
app.SetDefaultCommand<AsynchronousCommand>();
// When
var result = await app.RunAsync(new[]
{
"--ThrowException",
"true",
});
// Then
result.ExitCode.ShouldBe(-1);
}
[Fact]
public async Task Should_Throw_Exception_Asynchronously()
{
// Given
var app = new CommandAppTester();
app.SetDefaultCommand<AsynchronousCommand>();
app.Configure(config =>
{
config.PropagateExceptions();
});
// When
var result = await Record.ExceptionAsync(async () =>
await app.RunAsync(new[]
{
"--ThrowException",
"true",
}));
// Then
result.ShouldBeOfType<Exception>().And(ex =>
{
ex.Message.ShouldBe("Throwing exception asynchronously");
});
}
}
}