Skip to content

Commit 26d737d

Browse files
Final commit for adding aspire
1 parent 125a199 commit 26d737d

File tree

3 files changed

+5
-26
lines changed

3 files changed

+5
-26
lines changed
Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
var 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

75
builder.Build().Run();

src/Clean.Architecture.Web/Clean.Architecture.Web.csproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@
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>

tests/Clean.Architecture.AspireTests/AspireIntegrationTests.cs

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,6 @@ namespace Clean.Architecture.AspireTests.Tests;
22

33
public 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
}

0 commit comments

Comments
 (0)