I have a WebApplicationFactory which makes a call to MongoDB.Bson.Serialization.BsonClassMap.RegisterClassMap, which is fine when my first test run, but the second test crashes with error because this method was already called with similar args, because it’s state is preserved in static field. I can’t alter the code that causes the error.
Clearly, when I run all unit tests, they share the same environment with the same static variables. Can I somehow make sure that each test class run in different environment? The same effect as if I ran each test manually and separately.