Class ProtoWireMockBuilder

Namespace
ProtoTest.WireMock
Assembly
ProtoTest.WireMock.dll

Describes one fake HTTP service on the AddWireMock chain. A fake starts lazily on the first WireMock(name) call of a test: per-test fakes start a fresh server per test on a dynamic port, while PerRun() shares one server - stubs and request log included - across the run and clears them when the run releases it.

public sealed class ProtoWireMockBuilder
Inheritance
ProtoWireMockBuilder
Inherited Members
Extension Methods

Properties

Name

The fake's name, used by WireMock(name), the capability instance and the target.

public string Name { get; }

Property Value

string

Methods

PerRun()

Shares one server across the run instead of starting a fresh server per test. The shared server's stubs and request log live for the whole run, so a stub one test registers keeps matching in the next and the log is shared; call Reset() to clear both mid-run, or keep the fake for state a suite deliberately shares. Parallel tests share the log, and observations are attributed to the test whose teardown observed them.

public ProtoWireMockBuilder PerRun()

Returns

ProtoWireMockBuilder

Port(int)

Listens on a fixed port instead of a dynamic one, for a system under test that reads its dependency's address once at startup. Parallel tests must not share a fixed-port fake.

public ProtoWireMockBuilder Port(int port)

Parameters

port int

Returns

ProtoWireMockBuilder