mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-01-11 22:30:41 +01:00
Wiremock server fails to respond in framework 4.8 NUnit V3 test project class library #274
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @EthanM11122 on GitHub (May 21, 2020).
I'm trying to use wiremock to stub an endpoint in unit tests and I'm struggling to identify why it isn't working. I'm using Nunit in a .net framework 4.8 class library. When running the test normally it sits for 1 minute and then fails as the request's response status equals 0 not the expected 200.
If debugging the test it fails much faster for the same reason. I don't see any errors thrown but the response object has an error message
"The underlying connection was closed: An unexpected error occurred on a receive."
it appears that the server can't respond I suspect due to a deadlock.
The sample test I have is below. I feel I must be making a simple mistake somewhere as when I convert the test class library to a console application the test passes. Does an obvious mistake stand out to anyone?
@StefH commented on GitHub (May 21, 2020):
No Sorry, I cannot see any problems.
I did create a new NUnit project with this csproj:
And the test class looks like:
@EthanM11122 commented on GitHub (May 21, 2020):
Thanks @StefH, I was using a toolset generated project file when i moved to the SDK generated format it is now working.
@StefH commented on GitHub (May 21, 2020):
Ok