lundi 21 décembre 2015

C# unit test with Moq behaves differently when run alone to when run as part of a set

I have a unit test which verifies (using Moq), how many times a particular function was called. It should be called twice.

When you right-click on it in Visual Studio and run it, the test passes. When you run the entire suite - including this test - this test, and only this test, fails, saying the function was only called once.

There are no setup or teardown functions to run for this test - just the mock repository and a few lines of test code.

When right-clicking to run the test, I can debug it and verify that the function is question is indeed called twice. But as far as I know, I can't run an entire test suite in debug mode.

How can I find out why this test is behaving differently in the single and the suite run?

Aucun commentaire:

Enregistrer un commentaire