Categories
Agent Tooling (71)
- .agents/skills/agent-browser/references/authentication.md
- .agents/skills/agent-browser/references/commands.md
- .agents/skills/agent-browser/references/profiling.md
- .agents/skills/agent-browser/references/proxy-support.md
- .agents/skills/agent-browser/references/session-management.md
- .agents/skills/agent-browser/references/snapshot-refs.md
- .agents/skills/agent-browser/references/video-recording.md
- .agents/skills/agent-browser/SKILL.md
- .agents/skills/aspire-deployment/references/aws.md
- .agents/skills/aspire-deployment/references/azure.md
- .agents/skills/aspire-deployment/references/cicd.md
- .agents/skills/aspire-deployment/references/docker-compose.md
- .agents/skills/aspire-deployment/references/javascript.md
- .agents/skills/aspire-deployment/references/kubernetes.md
- .agents/skills/aspire-deployment/references/preflight.md
- .agents/skills/aspire-deployment/SKILL.md
- .agents/skills/aspire-monitoring/references/diagnostics-bridge.md
- .agents/skills/aspire-monitoring/references/monitoring.md
- .agents/skills/aspire-monitoring/references/playwright-handoff.md
- .agents/skills/aspire-monitoring/SKILL.md
- .agents/skills/aspire-orchestration/references/agent-workflows.md
- .agents/skills/aspire-orchestration/references/app-commands.md
- .agents/skills/aspire-orchestration/references/detection.md
- .agents/skills/aspire-orchestration/references/resource-management.md
- .agents/skills/aspire-orchestration/references/safety-guardrails.md
- .agents/skills/aspire-orchestration/SKILL.md
- .agents/skills/aspire/references/aspire-13-3-breaking-changes.md
- .agents/skills/aspire/SKILL.md
- .agents/skills/aspireify/references/apphost-wiring.md
- .agents/skills/aspireify/references/csharp-authoring.md
- .agents/skills/aspireify/references/docker-compose.md
- .agents/skills/aspireify/references/full-solution-apphosts.md
- .agents/skills/aspireify/references/javascript-apps.md
- .agents/skills/aspireify/references/opentelemetry.md
- .agents/skills/aspireify/references/scan-and-propose.md
- .agents/skills/aspireify/references/service-defaults.md
- .agents/skills/aspireify/references/typescript-authoring.md
- .agents/skills/aspireify/references/validation.md
- .agents/skills/aspireify/SKILL.md
- .agents/skills/caveman-compress/README.md
- .agents/skills/caveman-compress/SECURITY.md
- .agents/skills/caveman-compress/SKILL.md
- .agents/skills/caveman-help/README.md
- .agents/skills/caveman-help/SKILL.md
- .agents/skills/caveman-stats/README.md
- .agents/skills/caveman-stats/SKILL.md
- .agents/skills/caveman/README.md
- .agents/skills/caveman/SKILL.md
- .agents/skills/csharp-developer/SKILL.md
- .agents/skills/dotnet-inspect/SKILL.md
- .agents/skills/efcore-data-layer/SKILL.md
- .agents/skills/git/SKILL.md
- .agents/skills/microsoft-code-reference/SKILL.md
- .agents/skills/microsoft-docs/SKILL.md
- .agents/skills/microsoft-skill-creator/references/skill-templates.md
- .agents/skills/microsoft-skill-creator/SKILL.md
- .agents/skills/skill-creator/references/output-patterns.md
- .agents/skills/skill-creator/references/workflows.md
- .agents/skills/skill-creator/SKILL.md
- .agents/skills/tunit-testing/references/aspire-integration.md
- .agents/skills/tunit-testing/references/aspnetcore-integration.md
- .agents/skills/tunit-testing/references/assertions.md
- .agents/skills/tunit-testing/references/data-driven.md
- .agents/skills/tunit-testing/references/infrastructure-and-troubleshooting.md
- .agents/skills/tunit-testing/references/lifecycle-hooks.md
- .agents/skills/tunit-testing/SKILL.md
- AGENTS.md
- backend/AGENTS.md
- backend/tests/AGENTS.md
- Front/AGENT.md
- opencode.jsonc
Infrastructure And Troubleshooting
Patterns and pitfalls for shared infrastructure, live tests, and common TUnit issues.
Shared Infrastructure Orchestration
Prefer TUnit property injection chains over manual dependency wiring.
- shared expensive resources should usually use
[ClassDataSource<T>(Shared = SharedType.PerTestSession)] - dependent infrastructure objects should declare their dependencies as injected properties
- do not manually
newshared dependencies inside another shared fixture unless there is a strong reason - do not manually dispose dependencies that TUnit injected for you; each fixture should dispose only what it owns
Example:
public sealed class DockerNetwork : IAsyncInitializer, IAsyncDisposable
{
public INetwork Instance { get; } = new NetworkBuilder().Build();
public Task InitializeAsync() => Instance.CreateAsync();
public ValueTask DisposeAsync() => Instance.DisposeAsync();
}
public sealed class PostgresDatabase : IAsyncInitializer, IAsyncDisposable
{
[ClassDataSource<DockerNetwork>(Shared = SharedType.PerTestSession)]
public required DockerNetwork DockerNetwork { get; init; }
public PostgreSqlContainer Container => field ??= new PostgreSqlBuilder()
.WithNetwork(DockerNetwork.Instance)
.Build();
public async Task InitializeAsync() => await Container.StartAsync();
public async ValueTask DisposeAsync() => await Container.DisposeAsync();
}Live Test Opt-In
If your team wants live tests to stay out of the default dotnet test path, prefer an explicit runtime gate.
If the framework version does not provide a built-in explicit/manual runner switch that works cleanly in your CLI and CI flow, use:
Skip.Test(...)gated by an environment variable or custom skip attribute
Example:
private static void SkipIfLiveTestsDisabled()
{
if (!string.Equals(Environment.GetEnvironmentVariable("RUN_LIVE_TESTS"), "1", StringComparison.Ordinal))
{
Skip.Test("Live tests require RUN_LIVE_TESTS=1.");
}
}Apply the gate early:
- at the start of the test method
- and, if a test uses setup hooks or containers, at the start of the setup hook too
That avoids spinning up containers or external resources for tests that will be skipped anyway.
Assertion Pitfall: Arrays And Buffers
For arrays and buffers, IsEqualTo(...) may enforce exact equality semantics rather than element-wise equivalence.
For byte[] or similar payloads, prefer:
await Assert.That(actualBytes).IsEquivalentTo(expectedBytes);Use IsEqualTo(...) when exact scalar equality or ordered collection equality semantics are intended and supported by the assertion type.
Package Version Pitfall: Central Package Management
When using central package management, watch for transitive requirements introduced by newer TUnit packages.
Example failure mode:
- TUnit depends on
Microsoft.Testing.Extensions.TrxReport >= X Directory.Packages.propspinsMicrosoft.Testing.Extensions.TrxReportto an older version- restore fails with a package downgrade error
Guidance:
- keep centrally pinned
Microsoft.Testing.Platformextensions aligned with the minimum version required by the current TUnit version - when a downgrade appears, fix the central version instead of adding local project-level overrides unless there is a specific project isolation reason
Build/Test Lock Contention
Do not run overlapping dotnet build and dotnet test commands against the same outputs in parallel.
Typical symptom:
.deps.json/ output file lock failures
Preferred workflow:
- run test projects sequentially when they share build outputs
- run the final solution build only after test commands finish
Advanced Factory Overrides
Inside WebApplicationTest<TFactory, TEntryPoint>, Factory is a traced wrapper.
If you need raw WebApplicationFactory APIs such as WithWebHostBuilder(...), use Factory.Inner and, if needed, wrap the result back into TracedWebApplicationFactory<TEntryPoint>.
await using var customFactory = new TracedWebApplicationFactory<Program>(
Factory.Inner.WithWebHostBuilder(builder =>
{
builder.UseSetting("Feature:Enabled", bool.FalseString);
}));This preserves TUnit request tracing and log correlation for the derived factory.