Rig.TUnit.Observability.AppInsights 0.1.0-beta.2

This is a prerelease version of Rig.TUnit.Observability.AppInsights.
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
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Rig.TUnit.Observability.AppInsights" Version="0.1.0-beta.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Rig.TUnit.Observability.AppInsights" Version="0.1.0-beta.2" />
                    
Directory.Packages.props
<PackageReference Include="Rig.TUnit.Observability.AppInsights" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Rig.TUnit.Observability.AppInsights --version 0.1.0-beta.2
                    
#r "nuget: Rig.TUnit.Observability.AppInsights, 0.1.0-beta.2"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Rig.TUnit.Observability.AppInsights@0.1.0-beta.2
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Rig.TUnit.Observability.AppInsights&version=0.1.0-beta.2&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Rig.TUnit.Observability.AppInsights&version=0.1.0-beta.2&prerelease
                    
Install as a Cake Tool

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.ApplicationInsights 2.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.AppInsightsFixture
  • Rig.TUnit.Observability.AppInsights.Options.AppInsightsFixtureOptions
  • Rig.TUnit.Observability.AppInsights.Builder.AppInsightsRigBuilder
  • Rig.TUnit.Observability.AppInsights.Channels.CapturingTelemetryChannel
  • Rig.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 a TelemetryClient constructed 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; call fx.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; always Flush() first.
  • RoleName is set globally; parallel fixtures with different role names must not share a static TelemetryConfiguration.

Benchmarks

See AppInsightsBenchmarks.cs; baseline in benchmarks/baseline-005.json.

License

MIT. See LICENSE.

Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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