Hi, thanks for posting!
The behaviour of NCrunch will be slightly different in running this test compared with other test runners - although it isn't different quite in the way you may think it is.
Because NCrunch executes tests in batches, it tends to make multiple calls into a test process to execute different tests. Sometimes it may call into the same process multiple times to execute the same test, if asked to do so.
This is quite different from other test runners, that will tend to run all tests from start to finish inside one process, then tear the process down at the end. It's done to properly enable the parallel execution and distributed processing features, as well as to improve performance.
In this particular case, the test's TestFixtureSetUp method may be called multiple times, but only in the context of multiple test runs. For example, NCrunch may only call the TestFixtureSetUp method once when it tries to execute both tests as part of the same test run, but it will call the method twice if the ShouldTestSomethingOnce and ShouldTestSomethingElse tests are each executed in different test runs to service different tasks/batches.
Another way to explain this is if, for example, you were to try running your test using the NUnit UI twice. If you did this, NUnit would execute the Fixture Setup, then the test method. The second time you ran the test, it would once again execute the Fixture Setup, then the test method. NCrunch does exactly this, only it doesn't tear down the test runner process between the execution runs.
There's a
detailed explanation of this issue here. The solution is basically to allow your test and its setup methods to potentially be called multiple times within the same process.
I hope this makes sense.
Cheers,
Remco