Based on this article my implementation should work;
Xunit v2+
NCrunch V2.6 introduced direct integration with Xunit V2. Xunit V1 tests will continue to execute using the older Gallio adapter, while Xunit V2+ tests are run through NCrunch calling directly into the Xunit test runner.
My current versions:
NCrunch Version: 4.1.0.1
NCrunch # of CPU Core: 1
NCrunch Max Processing Threads: 1
Xunit Version: 2.3.1
Study Cases:
- When I run multiple times my tests using the option `Run selected test(s) with debugger` all my tests (more than 700) pass correctly.
- When I run my tests using `Run selected test(s) in a new process` all my tests fail.
- When I run my tests using `Run all test(s) visible here` all my tests fail.
public class IntegrationTestServer : IDisposable{
public IntegrationTestServer()
{
InitialiazeDataBases();
InitializeIdentityServer();
InitializeClientApi();
}
......
}
[CollectionDefinition("IntegrationTestServer")]
public class DatabaseCollection : ICollectionFixture<IntegrationTestServer>
{
// This class has no code, and is never created. Its purpose is simply
// to be the place to apply [CollectionDefinition] and all the
// ICollectionFixture<> interfaces.
}
[Collection("IntegrationTestServer")]
public class EventEntriesControllerIntegrationTest
{
private readonly IntegrationTestServer _fixtureServer;
public EventEntriesControllerIntegrationTest(IntegrationTestServer fixtureServer)
{
_fixtureServer = fixtureServer;
}
[Fact]
public async Task Should_RemoveEvent(){
.....
}
}