ADDED Test project #3

This commit is contained in:
Marek Lesko
2025-07-15 13:29:33 +02:00
parent 6f9864e6ac
commit aeeb3fd2f0
4 changed files with 74 additions and 1 deletions

38
Tests/IntegrationTest1.cs Normal file
View File

@@ -0,0 +1,38 @@
namespace Tests.Tests
{
public class IntegrationTest1
{
// Instructions:
// 1. Add a project reference to the target AppHost project, e.g.:
//
// <ItemGroup>
// <ProjectReference Include="../MyAspireApp.AppHost/MyAspireApp.AppHost.csproj" />
// </ItemGroup>
//
// 2. Uncomment the following example test and update 'Projects.MyAspireApp_AppHost' to match your AppHost project:
//
// [Fact]
// public async Task GetWebResourceRootReturnsOkStatusCode()
// {
// // Arrange
// var appHost = await DistributedApplicationTestingBuilder.CreateAsync<Projects.MyAspireApp_AppHost>();
// appHost.Services.ConfigureHttpClientDefaults(clientBuilder =>
// {
// clientBuilder.AddStandardResilienceHandler();
// });
// // To output logs to the xUnit.net ITestOutputHelper, consider adding a package from https://www.nuget.org/packages?q=xunit+logging
//
// await using var app = await appHost.BuildAsync();
// var resourceNotificationService = app.Services.GetRequiredService<ResourceNotificationService>();
// await app.StartAsync();
// // Act
// var httpClient = app.CreateHttpClient("webfrontend");
// await resourceNotificationService.WaitForResourceAsync("webfrontend", KnownResourceStates.Running).WaitAsync(TimeSpan.FromSeconds(30));
// var response = await httpClient.GetAsync("/");
// // Assert
// Assert.Equal(HttpStatusCode.OK, response.StatusCode);
// }
}
}