Innovabit.DotNet.Interceptors.Testing
2.0.105
See the version list below for details.
dotnet add package Innovabit.DotNet.Interceptors.Testing --version 2.0.105
NuGet\Install-Package Innovabit.DotNet.Interceptors.Testing -Version 2.0.105
<PackageReference Include="Innovabit.DotNet.Interceptors.Testing" Version="2.0.105" />
<PackageVersion Include="Innovabit.DotNet.Interceptors.Testing" Version="2.0.105" />
<PackageReference Include="Innovabit.DotNet.Interceptors.Testing" />
paket add Innovabit.DotNet.Interceptors.Testing --version 2.0.105
#r "nuget: Innovabit.DotNet.Interceptors.Testing, 2.0.105"
#:package Innovabit.DotNet.Interceptors.Testing@2.0.105
#addin nuget:?package=Innovabit.DotNet.Interceptors.Testing&version=2.0.105
#tool nuget:?package=Innovabit.DotNet.Interceptors.Testing&version=2.0.105
Innovabit.DotNet.Interceptors.Testing
Test helpers for interceptors built on
Innovabit.DotNet.Interceptors.Abstractions.
Framework-agnostic: it pulls in no test framework, so it works with xUnit, NUnit or MSTest.
These are the two things this repository's own ~1800 tests do, packaged up.
Driving an interceptor directly
FakeInvocation is an IInvocation you construct by hand, so CanIntercept and the three
ProcessInterception* methods can be called without a proxy, a container, or the service under
test. Proceed() runs the delegate you hand it — that is the intercepted method — and the harness
counts the calls.
var invocation = FakeInvocation.For<Sample>(
nameof(Sample.ChargeAsync),
[order],
call => call.ReturnValue = Task.FromException<int>(new TimeoutException()));
await Assert.ThrowsAsync<TimeoutException>(() => interceptor.ProcessInterceptionAsync<int>(invocation));
Assert.Equal(3, invocation.ProceedCount); // it retried twice
That is the whole point: a retry, a circuit breaker or a cache is about how many times the method is reached and with what, which a fake invocation answers directly and a real call does not.
Exercising a real pipeline
InterceptorHarness builds a container with one intercepted service in it, for the questions a
fake invocation cannot answer — ordering, several interceptors together, and whether an attribute
survives the trip through a real Castle proxy.
using var harness = InterceptorHarness.For<IOrderService, OrderService>(
builder => builder.AddRetry().AddTimeout());
await harness.Get<IOrderService>().PlaceAsync(order);
Resolution happens inside a scope the harness owns and scope validation is on, so a scoped
interceptor behaves as it does in an application — and a lifetime mistake surfaces in the test
rather than in production. ForClass<T>() does the same for a service with no interface, and
Build(services) wraps a collection you assembled yourself.
Describe() returns the pipeline report, which is what to assert on when the test is about
ordering rather than behaviour:
Assert.Equal(
[typeof(RetryInterceptor), typeof(TimeoutInterceptor)],
harness.Describe().Interceptors.Select(interceptor => interceptor.InterceptorType));
Part of
The Innovabit.DotNet.Interceptors suite —
github.com/Innovabit/dotnet-interceptors.
License
MIT
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. 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
- Innovabit.DotNet.Interceptors.Abstractions (>= 2.0.105)
- Microsoft.Extensions.DependencyInjection (>= 10.0.12)
-
net8.0
- Innovabit.DotNet.Interceptors.Abstractions (>= 2.0.105)
- Microsoft.Extensions.DependencyInjection (>= 10.0.12)
-
net9.0
- Innovabit.DotNet.Interceptors.Abstractions (>= 2.0.105)
- Microsoft.Extensions.DependencyInjection (>= 10.0.12)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 2.0.119 | 53 | 11/14/2026 |
| 2.0.118 | 100 | 11/7/2026 |
| 2.0.117 | 113 | 10/31/2026 |
| 2.0.116 | 100 | 10/26/2026 |
| 2.0.115 | 114 | 10/17/2026 |
| 2.0.114 | 100 | 10/10/2026 |
| 2.0.113 | 105 | 10/3/2026 |
| 2.0.112 | 108 | 9/28/2026 |
| 2.0.111 | 98 | 9/28/2026 |
| 2.0.110 | 101 | 9/27/2026 |
| 2.0.109 | 102 | 9/26/2026 |
| 2.0.108 | 98 | 9/26/2026 |
| 2.0.107 | 102 | 9/26/2026 |
| 2.0.106 | 115 | 9/25/2026 |
| 2.0.105 | 104 | 9/25/2026 |