File tree Expand file tree Collapse file tree 3 files changed +5
-26
lines changed
Clean.Architecture.AspireHost
tests/Clean.Architecture.AspireTests Expand file tree Collapse file tree 3 files changed +5
-26
lines changed Original file line number Diff line number Diff line change 11var builder = DistributedApplication . CreateBuilder ( args ) ;
22
3- builder
4- . AddProject < Projects . Clean_Architecture_Web > ( "web" )
5- . WithExternalHttpEndpoints ( ) ;
3+ builder . AddProject < Projects . Clean_Architecture_Web > ( "web" ) ;
64
75builder . Build ( ) . Run ( ) ;
Original file line number Diff line number Diff line change 2525 <ItemGroup >
2626 <ProjectReference Include =" ..\Clean.Architecture.Infrastructure\Clean.Architecture.Infrastructure.csproj" />
2727 <ProjectReference Include =" ..\Clean.Architecture.UseCases\Clean.Architecture.UseCases.csproj" />
28+ <!-- #if (aspire)-->
2829 <ProjectReference Include =" ..\Clean.Architecture.ServiceDefaults\Clean.Architecture.ServiceDefaults.csproj" />
30+ <!-- #endif -->
2931 </ItemGroup >
3032
3133</Project >
Original file line number Diff line number Diff line change @@ -2,27 +2,6 @@ namespace Clean.Architecture.AspireTests.Tests;
22
33public class AspireIntegrationTests
44{
5- [ Fact ]
6- public async Task GetContributorsReturnsOkStatusCode ( )
7- {
8- // Arrange
9- var appHost = await DistributedApplicationTestingBuilder . CreateAsync < Projects . Clean_Architecture_AspireHost > ( ) ;
10- appHost . Services . ConfigureHttpClientDefaults ( clientBuilder =>
11- {
12- clientBuilder . AddStandardResilienceHandler ( ) ;
13- } ) ;
14- // To output logs to the xUnit.net ITestOutputHelper, consider adding a package from https://www.nuget.org/packages?q=xunit+logging
15-
16- await using var app = await appHost . BuildAsync ( ) ;
17- var resourceNotificationService = app . Services . GetRequiredService < ResourceNotificationService > ( ) ;
18- await app . StartAsync ( ) ;
19-
20- // Act
21- var httpClient = app . CreateHttpClient ( "web" ) ;
22- await resourceNotificationService . WaitForResourceAsync ( "web" , KnownResourceStates . Running ) . WaitAsync ( TimeSpan . FromSeconds ( 30 ) ) ;
23- var response = await httpClient . GetAsync ( "/Contributors" ) ;
24-
25- // Assert
26- Assert . Equal ( HttpStatusCode . OK , response . StatusCode ) ;
27- }
5+ // Follow the link below to write you tests with Aspire
6+ // https://learn.microsoft.com/en-us/dotnet/aspire/testing/write-your-first-test?pivots=xunit
287}
You can’t perform that action at this time.
0 commit comments