You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm writing unit tests for a library that generates REST web service clients from an interface. As a result I need to verify the values provided by the HttpRequestMessage while I mock out the HttpClient. My tests are written like this:
verifyRequest is an Action<HttpRequestMessage> so that I can run my fluent assertions on the provided object. I'm experiencing some strangeness with Moq, and I don't know if its the set up, or what.
I have two classes with tests, so the test runner is running them in parallel. One of my assertions is failing because the HttpRequestMessage instance that was created for one class in the other. It's always the first tests that are getting the cross-talk, and it's always the same test that's failing. However, when I run that test in isolation it passes.
I'm at a loss as to explain this. I want to use Moq, but I also need my unit tests to run consistently so I can have full confidence that the generated classes aren't causing problems.
The text was updated successfully, but these errors were encountered:
Nevermind. This is a stupid issue on my end. Has to do with how the HttpClient is used. Have to ensure my tests are singlethreaded even though the code itself is threadsafe.
bloritsch
changed the title
Callback may not be threadsafe
Callback may not be threadsafe (ID10T error)
Aug 2, 2018
I'm writing unit tests for a library that generates REST web service clients from an interface. As a result I need to verify the values provided by the HttpRequestMessage while I mock out the HttpClient. My tests are written like this:
verifyRequest
is anAction<HttpRequestMessage>
so that I can run my fluent assertions on the provided object. I'm experiencing some strangeness with Moq, and I don't know if its the set up, or what.I have two classes with tests, so the test runner is running them in parallel. One of my assertions is failing because the
HttpRequestMessage
instance that was created for one class in the other. It's always the first tests that are getting the cross-talk, and it's always the same test that's failing. However, when I run that test in isolation it passes.My repository is here: https://github.com/bloritsch/DHaven.Faux/tree/DHaven.Faux-19
I'm at a loss as to explain this. I want to use Moq, but I also need my unit tests to run consistently so I can have full confidence that the generated classes aren't causing problems.
The text was updated successfully, but these errors were encountered: