Skip to content

Add BeASimulatedFailure assertion (companion to mockly#116) #31

Description

@dennisdoomen

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions