Added A-Frame Architecture Sample.

This commit is contained in:
2026-06-08 20:19:41 +02:00
parent b2d7e7e26b
commit 6760f90336
63 changed files with 5075 additions and 0 deletions
@@ -0,0 +1,40 @@
using Microsoft.Extensions.Logging;
namespace AFrameArchitectureSample.Tests;
public class WebTests
{
private static readonly TimeSpan DefaultTimeout = TimeSpan.FromSeconds(30);
[Fact]
public async Task GetWebResourceRootReturnsOkStatusCode()
{
// Arrange
var cancellationToken = TestContext.Current.CancellationToken;
var appHost = await DistributedApplicationTestingBuilder.CreateAsync<Projects.AFrameArchitectureSample_AppHost>(cancellationToken);
appHost.Services.AddLogging(logging =>
{
logging.SetMinimumLevel(LogLevel.Debug);
// Override the logging filters from the app's configuration
logging.AddFilter(appHost.Environment.ApplicationName, LogLevel.Debug);
logging.AddFilter("Aspire.", LogLevel.Debug);
// To output logs to the xUnit.net ITestOutputHelper, consider adding a package from https://www.nuget.org/packages?q=xunit+logging
});
appHost.Services.ConfigureHttpClientDefaults(clientBuilder =>
{
clientBuilder.AddStandardResilienceHandler();
});
await using var app = await appHost.BuildAsync(cancellationToken).WaitAsync(DefaultTimeout, cancellationToken);
await app.StartAsync(cancellationToken).WaitAsync(DefaultTimeout, cancellationToken);
// Act
var httpClient = app.CreateHttpClient("webfrontend");
await app.ResourceNotifications.WaitForResourceHealthyAsync("webfrontend", cancellationToken).WaitAsync(DefaultTimeout, cancellationToken);
var response = await httpClient.GetAsync("/", cancellationToken);
// Assert
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
}
}