Companion to dennisdoomen/mockly#116 (simulated network failures: ThrowsException / TimesOut), PR dennisdoomen/mockly#136.
Summary
Add an assertion to verify that a captured entry corresponds to an intended simulated failure (a thrown transport error / timeout) rather than an unexpected 500 or a normal response.
Proposed API (additive)
On CapturedRequestAssertions in Shared/HttpMockAssertionExtensions.cs (next to the existing BeExpected() / BeUnexpected()):
AndConstraint<CapturedRequestAssertions> BeASimulatedFailure(string because = "", params object[] becauseArgs);
Implementation notes
- Follow the existing
BeExpected/BeUnexpected patterns.
- Update BOTH
v7 and v8 packages (shared via Shared/); add specs to both .Specs projects.
- Run
AcceptApiChanges.ps1 and commit updated approved-API files.
Dependency / blocker (IMPORTANT)
This needs the core Mockly to expose a public signal on CapturedRequest indicating the entry was a simulated failure (e.g. a SimulatedException / WasSimulatedFailure property). The core PR dennisdoomen/mockly#136 records the failed call in Requests but may not yet expose such a flag — confirm, and if missing, file/extend a small core change first. Implement after dennisdoomen/mockly#116 (PR #136) is merged and a new Mockly package is published.
Companion to dennisdoomen/mockly#116 (simulated network failures: ThrowsException / TimesOut), PR dennisdoomen/mockly#136.
Summary
Add an assertion to verify that a captured entry corresponds to an intended simulated failure (a thrown transport error / timeout) rather than an unexpected 500 or a normal response.
Proposed API (additive)
On
CapturedRequestAssertionsinShared/HttpMockAssertionExtensions.cs(next to the existingBeExpected()/BeUnexpected()):Implementation notes
BeExpected/BeUnexpectedpatterns.v7andv8packages (shared viaShared/); add specs to both.Specsprojects.AcceptApiChanges.ps1and commit updated approved-API files.Dependency / blocker (IMPORTANT)
This needs the core Mockly to expose a public signal on
CapturedRequestindicating the entry was a simulated failure (e.g. aSimulatedException/WasSimulatedFailureproperty). The core PR dennisdoomen/mockly#136 records the failed call inRequestsbut may not yet expose such a flag — confirm, and if missing, file/extend a small core change first. Implement after dennisdoomen/mockly#116 (PR #136) is merged and a new Mockly package is published.