mocking-inprocess-dotnet

In-process .NET adapter (override): replaces a downstream dependency with a test double registered in the WebApplicationFactory DI — selected when the operator overrides the Microcks default.

When to use

Entry contract

Exit contract

Invariants

Library table (priority order — top = highest)

Priority Library NuGet Double creation
1 FakeItEasy FakeItEasy A.Fake<I{Downstream}Client>()
2 NSubstitute NSubstitute Substitute.For<I{Downstream}Client>()
3 Moq Moq new Mock<I{Downstream}Client>() (use .Object)

Why this shape

Swapping a dependency in the DI container at the transport boundary keeps tests fast and deterministic without container overhead, while still exercising the real application composition.

« Replace a component that the SUT depends on with a test-specific equivalent. » — Meszaros, G., xUnit Test Patterns, 2007.

Allowed customisation

See also