Update .gitignore to exclude TypeScript build info and add dist directory. Expand README with project overview, technology stack, prerequisites, and instructions for running and testing the application.
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace HSchool.AppHost.Tests;
|
||||
|
||||
/// <summary>
|
||||
/// Boots the AppHost once for the whole suite — starting it per test costs about ten
|
||||
/// seconds each. The client resource is skipped (<c>HSchool:Headless</c>), so the tests
|
||||
/// need no Node install.
|
||||
/// </summary>
|
||||
public sealed class AppHostFixture : IAsyncLifetime
|
||||
{
|
||||
private static readonly TimeSpan StartupTimeout = TimeSpan.FromSeconds(120);
|
||||
|
||||
private DistributedApplication? _app;
|
||||
|
||||
public DistributedApplication App =>
|
||||
_app ?? throw new InvalidOperationException("The AppHost has not been started.");
|
||||
|
||||
public async ValueTask InitializeAsync()
|
||||
{
|
||||
var appHost = await DistributedApplicationTestingBuilder
|
||||
.CreateAsync<Projects.HSchool_AppHost>(["--HSchool:Headless=true"], CancellationToken.None);
|
||||
|
||||
appHost.Services.AddLogging(logging =>
|
||||
{
|
||||
logging.SetMinimumLevel(LogLevel.Warning);
|
||||
logging.AddFilter("Aspire.", LogLevel.Warning);
|
||||
});
|
||||
|
||||
_app = await appHost.BuildAsync().WaitAsync(StartupTimeout);
|
||||
await _app.StartAsync().WaitAsync(StartupTimeout);
|
||||
await _app.ResourceNotifications
|
||||
.WaitForResourceHealthyAsync("server", CancellationToken.None)
|
||||
.WaitAsync(StartupTimeout);
|
||||
}
|
||||
|
||||
public async ValueTask DisposeAsync()
|
||||
{
|
||||
if (_app is not null)
|
||||
{
|
||||
await _app.DisposeAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Groups every integration test around the single AppHost instance.</summary>
|
||||
[CollectionDefinition(Name)]
|
||||
public sealed class AppHostCollection : ICollectionFixture<AppHostFixture>
|
||||
{
|
||||
public const string Name = "apphost";
|
||||
}
|
||||
Reference in New Issue
Block a user