Files
WireMock.Net/test/WireMock.Net.Tests
m4tchl0ck f919929cb7 Add injectable IScenarioStateStore for distributed scenario state (#1430)
* Move ScenarioState to Abstractions and add IScenarioStateStore interface

ScenarioState is moved to the Abstractions project so it can be referenced
by the new IScenarioStateStore interface. The interface defines the contract
for storing and retrieving scenario states, enabling distributed implementations.

* Add InMemoryScenarioStateStore default implementation

Wraps ConcurrentDictionary with OrdinalIgnoreCase comparer, preserving
exact current behavior. The Update method encapsulates read-modify-write
so distributed implementations can make it atomic.

* Wire IScenarioStateStore into middleware options, settings, and consumers

Replace direct ConcurrentDictionary<string, ScenarioState> usage with
IScenarioStateStore across all consumer files. The store is injectable
via WireMockServerSettings.ScenarioStateStore, defaulting to the
InMemoryScenarioStateStore for backward compatibility.

* Add FileBasedScenarioStateStore for persistent scenario state

In-memory ConcurrentDictionary backed by JSON file persistence in
__admin/scenarios/. Reads from cache, mutations write through to disk.
Constructor loads existing state from disk on startup.

* Make ScenarioStateStore non-nullable with default InMemoryScenarioStateStore

Move InMemoryScenarioStateStore from WireMock.Net.Minimal to
WireMock.Net.Shared so it lives alongside WireMockServerSettings.
This allows WireMockServerSettings.ScenarioStateStore to be
non-nullable with a default value, following the same pattern as
DefaultJsonSerializer. The null-coalescing fallback in
WireMockMiddlewareOptionsHelper is no longer needed.
2026-03-25 13:04:44 +01:00
..
2026-03-11 17:02:47 +01:00
2026-03-11 17:02:47 +01:00
2026-03-11 17:02:47 +01:00
2026-03-11 17:02:47 +01:00
2026-03-11 17:02:47 +01:00
2026-03-11 17:02:47 +01:00
2026-03-11 17:02:47 +01:00
2026-03-11 17:02:47 +01:00
2026-03-11 17:02:47 +01:00
2026-03-11 17:02:47 +01:00
2026-03-11 17:02:47 +01:00
2026-03-11 17:02:47 +01:00
2026-03-11 17:02:47 +01:00
2026-03-11 17:02:47 +01:00
2026-03-11 17:02:47 +01:00
2026-03-11 17:02:47 +01:00
2026-03-11 17:02:47 +01:00
2026-03-11 17:02:47 +01:00
2026-03-11 17:02:47 +01:00
2026-03-11 17:02:47 +01:00
2026-03-11 17:02:47 +01:00
2026-03-11 17:02:47 +01:00
2026-03-11 17:02:47 +01:00
2026-03-11 17:02:47 +01:00
2026-03-11 17:02:47 +01:00
2026-03-11 17:02:47 +01:00
2026-03-11 17:02:47 +01:00
2026-03-11 17:02:47 +01:00
2026-03-11 17:02:47 +01:00
2026-03-11 17:02:47 +01:00
2026-03-11 17:02:47 +01:00
2026-03-11 17:02:47 +01:00
2026-03-11 17:02:47 +01:00

Creating a client certificate like client_cert.pfx

Follow the instructions to create a root certificate, then trust it and create a child certificate from it.

Since the root certificate of client_cert.pfx is obviously not trusted automatically by cloning this repo, the tests in WireMockServerTests.ClientCertificate.cs set WireMockServerSettings.AcceptAnyClientCertificate to true so that tests pass even if the device hasn't trusted the root of client_cert.pfx.