Replies: 1 comment 1 reply
-
|
I would remove the static and just set them up for each test. By having them static, they'll be shared/leaking across tests and race conditions and other problems will occur . Best to give each test it's own instance so it's not affected by other running tests |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I have a fairly simple NSubstitute mock set up for a unit test that fails when the test is run as part of the full suite of tests. However, when run manually or with [NotInParallel], it runs as expected. As a C# testing n00b, is there something that I can do to fix this problem, or do I get over myself and let the test run [NotInParallel]
The test mock is shown below. I have tried specifying actual test strings but it didn't change the outcome.
As this is supposed to be a 'passing' test, valid string values are provided for both parameters
mockParamChecker.TestStringNotNullOrEmpty(Arg.Any<string>(), Arg.Any<string>()).Returns(true);For testing efficiency, it is setup and injected as part of a Before(Class) method
The test itself is
Beta Was this translation helpful? Give feedback.
All reactions