Unit tests fail when I run all tests, but pass when I debug

I am using NUnit3 in Visual Studio 2017 and am doing TDD. Something really strange is happening since I updated my code to do my last test.

Now, 3 of my other tests fail when I click Run All Tests, as shown below:

enter image description here

Tells me that the actual and expected values ​​in my Assert method are not equal.

However, when I put a breakpoint on the line where the Assert method is used and starts debugging, stacktrace shows that the expected and actual values ​​have the same value, and then the test passes as shown below:

enter image description here

Am I doing something stupid or maybe there is a bug in VS2017 or NUnit or something like that?

Does this ever happen to anyone else?

[Edit: , ]

+4
2

, . .

. , , , .

+5

. , , , , .

, , .

, :

- - ?

- VS2017 NUnit - ?

, , :

+2

Source: https://habr.com/ru/post/1677090/


All Articles