Rig.TUnit.Observability.AppInsights
0.1.0-beta.2
dotnet add package Rig.TUnit.Observability.AppInsights --version 0.1.0-beta.2
NuGet\Install-Package Rig.TUnit.Observability.AppInsights -Version 0.1.0-beta.2
<PackageReference Include="Rig.TUnit.Observability.AppInsights" Version="0.1.0-beta.2" />
<PackageVersion Include="Rig.TUnit.Observability.AppInsights" Version="0.1.0-beta.2" />
<PackageReference Include="Rig.TUnit.Observability.AppInsights" />
paket add Rig.TUnit.Observability.AppInsights --version 0.1.0-beta.2
#r "nuget: Rig.TUnit.Observability.AppInsights, 0.1.0-beta.2"
#:package Rig.TUnit.Observability.AppInsights@0.1.0-beta.2
#addin nuget:?package=Rig.TUnit.Observability.AppInsights&version=0.1.0-beta.2&prerelease
#tool nuget:?package=Rig.TUnit.Observability.AppInsights&version=0.1.0-beta.2&prerelease
Rig.TUnit.Observability.AppInsights
In-process Application Insights fixture with
CapturingTelemetryChannel— zero network egress, deterministic assertions.
What this package is
A fixture that wires a real TelemetryClient to a
CapturingTelemetryChannel — the client API is production-identical
but the channel records every item into a thread-safe queue instead of
sending to Azure. Tests assert via AppInsightsAssert.Event(…),
.Dependency(…), .Exception<T>(…) with the familiar fluent shape.
When to use it
- Integration tests for services using
Microsoft.ApplicationInsights. - Verifying custom events and dependency tracking fire at the right points.
- Asserting exception telemetry is emitted with correct properties.
- Not for: E2E tests against real Azure — those require a real instrumentation key and network access.
Prerequisites
- .NET 10 SDK
Microsoft.ApplicationInsights2.x (transitive)
Quick start
using Rig.TUnit.Observability.AppInsights.Fixtures;
await using var fx = new AppInsightsFixture();
await fx.InitializeAsync();
fx.Client.TrackEvent("order.placed");
Options
| Property | Type | Default | Description |
|---|---|---|---|
InstrumentationKey |
string |
"00000000-0000-0000-0000-000000000000" |
Placeholder — no egress |
RoleName |
string |
"rigtunit-tests" |
cloud_RoleName on every item |
EnableLiveMetrics |
bool |
false |
Off — Live Metrics is an egress path |
Fixture + helper APIs
Rig.TUnit.Observability.AppInsights.Fixtures.AppInsightsFixtureRig.TUnit.Observability.AppInsights.Options.AppInsightsFixtureOptionsRig.TUnit.Observability.AppInsights.Builder.AppInsightsRigBuilderRig.TUnit.Observability.AppInsights.Channels.CapturingTelemetryChannelRig.TUnit.Observability.AppInsights.Assertions.AppInsightsAssert
Per-test isolation
Each AppInsightsFixture owns its channel; captured items are never
cross-test visible. Safe under full parallelism.
Parallelism + performance
- Fixture construction: ~2 ms.
Track*call overhead: ~5 µs (no network).- Safe under full parallelism.
Troubleshooting
- Telemetry not captured — ensure you are using
fx.Client, not aTelemetryClientconstructed elsewhere; only the fixture's client is wired to the capturing channel. AppInsightsAssert.Event(…).Exactly(1)fails with 0 — some telemetry is batched by the SDK; callfx.Client.Flush()before asserting.
See docs/troubleshooting.md#appinsights.
Provider quirks + edge cases
- The capturing channel stores items in a
ConcurrentQueue— the assertion API LINQs over the snapshot, so very fast producers can observe a count mid-flight; alwaysFlush()first. RoleNameis set globally; parallel fixtures with different role names must not share a staticTelemetryConfiguration.
Benchmarks
See AppInsightsBenchmarks.cs;
baseline in benchmarks/baseline-005.json.
Related docs
- Architecture diagram
- Glossary
- Family base:
Rig.TUnit.Observability
License
MIT. See LICENSE.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Bogus (>= 35.6.1)
- Microsoft.ApplicationInsights (>= 2.23.0)
- Microsoft.Extensions.Configuration (>= 10.0.0)
- Microsoft.Extensions.Configuration.Binder (>= 10.0.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.0)
- Microsoft.Extensions.Options (>= 10.0.0)
- Microsoft.Extensions.Options.DataAnnotations (>= 10.0.0)
- Rig.TUnit.Observability (>= 0.1.0-beta.2)
- TUnit.Core (>= 1.34.5)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Rig.TUnit.Observability.AppInsights:
| Package | Downloads |
|---|---|
|
Rig.TUnit.All
Meta-package containing every Rig.TUnit.* package. DISCOURAGED — prefer per-feature or per-stack meta-packages (Rig.TUnit, Rig.TUnit.Microservices). |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.1.0-beta.2 | 42 | 4/27/2026 |
| 0.0.0-alpha.0.14 | 43 | 4/26/2026 |