mocking-microcks-dotnetlisted
Install: claude install-skill SebastienDegodez/skraft-plugin
# Mocking — Microcks x .NET adapter (default)
Concrete recipe that mocks a downstream dependency the SUT calls, using a
Microcks container seeded from the dependency's OpenAPI/examples contract, and
wires it into a `WebApplicationFactory` integration test.
Loaded ONLY when `mocking-strategy-roster` resolved `(microcks, .NET)`.
**Boundary:** this adapter produces mock wiring + an integration-test scaffold.
It does NOT drive RED->GREEN, does NOT enforce Object Calisthenics, does NOT
verify a provider contract (`VerifyAsync` is contract-testing, a different
capability). The `software-engineer` lead integrates this into its own TDD loop.
## NuGet packages
```
Microcks.Testcontainers
Testcontainers
```
## Recipe — mock the downstream + wire the test host
Use a `MicrocksContainerEnsemble` seeded from the DOWNSTREAM dependency's
contract, then point the SUT's client at the mock endpoint via configuration.
The real API is `GetRestMockEndpoint(serviceName, version)` (note: `+` encodes a
space in the service name, e.g. `"API+Pastries"`).
```csharp
public class {Sut}WebApplicationFactory<TProgram> : WebApplicationFactory<TProgram>, IAsyncLifetime
where TProgram : class
{
private const string MicrocksImage = "quay.io/microcks/microcks-uber:1.14.0-native";
public MicrocksContainerEnsemble MicrocksContainerEnsemble { get; private set; } = null!;
public async ValueTask InitializeAsync()
{
var network = new NetworkBuilder().Build();
// Seed mocks