-
Notifications
You must be signed in to change notification settings - Fork 88
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve VerifyNoOutstandingExpectation message outpu #78
Comments
I have been considering how this could also be further improved by the |
@richardszalay Would you accept community contributions towards this, as I would be interested in working on this. |
I've been considering the design of this. I was thinking of extending the definition of I was also thinking for the |
In the current implementation in #92, the exception message looks like:
For multiple unfulfilled requests, they're also separated by an AND so:
This should be a good start to the feature and imo should allow developers to pretty easily see what might be missing. Does anyone else have thoughts on this? |
This looks like a good step forward. I like where this is going. If match doesn't specify headers or form data, etc, could you skip showing it? There are 1 unfulfilled expectations: |
That's how it works at the moment, it will only display information for configured matchers on an expected request. For example, a configuration that would yield my first example if unmatched would look like: mockHandler
.Expect(HttpMethod.Post, "/test")
.WithHeaders(new Dictionary<string, string>
{
{ "Header", "HeaderValue" }
})
.WithFormData($"FormField=FormValue")
.WithAny(new PartialContentMatcher("TestContent"), new PartialContentMatcher("SomeOtherContent"))
.Respond("application/json", "{'status' : 'First'}"); |
Currently, when I have a mismatched .Expect, and call mockHttp.VerifyNoOutstandingExpectation(), I get this message "System.InvalidOperationException: There are 1 unfulfilled expectations".
It'd be really nice for it to list the calls that were made to the mockHttp and the actual value.
If we have this call (from the readme)
and FormData is something else the the output could say.
There are 1 unfulfilled expectations.
$"/tokens/refresh was called with {formData}"
similar for withContent, etc.
Thanks for making this Nuget package. It's been very helpful for my unit testing.
The text was updated successfully, but these errors were encountered: