From kagents
.NET Aspire integration testing — DistributedApplicationTestingBuilder, AppHost test fixtures, service mocking, health check validation, TUnit with ClassDataSource. USE FOR: writing and debugging integration tests against Aspire-orchestrated services. DO NOT USE FOR: Aspire app configuration (use aspire-architecture) or unit tests without Aspire (use tunit-patterns).
npx claudepluginhub grexyloco/k.agents --plugin kagentsThis skill uses the workspace's default tool permissions.
Adaptiert von: [Aaronontheweb/dotnet-skills](https://github.com/Aaronontheweb/dotnet-skills) (MIT)
Guides Next.js Cache Components and Partial Prerendering (PPR) with cacheComponents enabled. Implements 'use cache', cacheLife(), cacheTag(), revalidateTag(), static/dynamic optimization, and cache debugging.
Guides building MCP servers enabling LLMs to interact with external services via tools. Covers best practices, TypeScript/Node (MCP SDK), Python (FastMCP).
Share bugs, ideas, or general feedback.
Adaptiert von: Aaronontheweb/dotnet-skills (MIT) Angepasst für TUnit (nicht xUnit wie im Original).
<PackageReference Include="Aspire.Hosting.Testing" Version="*" />
<PackageReference Include="TUnit" Version="*" />
public class AspireAppFixture : IAsyncDisposable
{
public DistributedApplication App { get; private set; } = null!;
public HttpClient ApiClient { get; private set; } = null!;
public AspireAppFixture()
{
var builder = await DistributedApplicationTestingBuilder
.CreateAsync<Projects.MyApp_AppHost>();
// Optional: Services mocken oder konfigurieren
builder.Services.ConfigureHttpClientDefaults(http =>
http.AddStandardResilienceHandler());
App = await builder.BuildAsync();
await App.StartAsync();
ApiClient = App.CreateHttpClient("api");
}
public async ValueTask DisposeAsync()
{
await App.DisposeAsync();
ApiClient.Dispose();
}
}
[Test]
[ClassDataSource<AspireAppFixture>(Shared = SharedType.PerTestSession)]
public async Task Api_HealthCheck_ReturnsHealthy(AspireAppFixture app)
{
var response = await app.ApiClient.GetAsync("/health");
await Assert.That((int)response.StatusCode).IsEqualTo(200);
}
[Test]
[ClassDataSource<AspireAppFixture>(Shared = SharedType.PerTestSession)]
public async Task Api_GetUsers_ReturnsData(AspireAppFixture app)
{
var response = await app.ApiClient.GetAsync("/api/users");
response.EnsureSuccessStatusCode();
var users = await response.Content.ReadFromJsonAsync<List<UserResponse>>();
await Assert.That(users).IsNotNull();
}
// Dashboard-URL für Debugging
var dashboardUrl = App.GetEndpoint("aspire-dashboard");
// Logs und Traces live beobachten während Tests laufen
PerTestSession Shared Scope um AppHost nur einmal zu startenCreateHttpClient("service-name") nutzt Service Discovery