Fixed the StatusCodeSuccessAssertion #198
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Ok - not sure this is the right approach, but I sort of messed up the
StatusCodeShouldBeSuccess()
Assertion last year.I actually noticed this when recording a video with @jeremydmiller. ;(
I feel like I made too big of a change here, and don't mind rejection or feedback.
The issue is the StatusCodeShouldBeSuccess() collided with the default (StatusCodeShouldBeOk).
Since StatusCodes are pretty binary - you wouldn't have multiple checks for different status codes in the same scenario, the
Scenario.cs
has aIgnoreStatusCode()
you can use. so in order for theStatusCodeShouldBeSuccess()
to work, you'd have to do something like:That seems weird to me.
What I propose, meekly, with this PR is (egads) a "Marker Interface" for any Assertion that deals with Status Codes. (
IStatusCodeAssertion
).In the
Scenario.cs
'sRunAssertions
, you set_ignoreStatusCode
to true (if it isn't already) if there are any_assertions
that implement that interface.Now, the above can be written as:
I considered throwing something if there are more than one assertion that is
IStatusCodeAssertion
, but that feels too heavy handed.If this is accepted (and I can't help but think there might be a better way, or someone will see a problem with this), I'd be willing to update the documentation at https://jasperfx.github.io/alba/scenarios/assertions.html.
Thanks, and sorry?