I'm using C# with NUnit.
Let's say you have a class
public class MyClass {
private int classMember;
[Test]
public void Test1() {
classMember = 1;
Assert.That(classMember == 1);
}
[Test]
public void Test2() {
classMember = 2;
Assert.That(classMember == 2);
}
}
I'm wondering if it's possible for Test1() and Test2() to run concurrently and interfere with each other. For example, if Test1 and Test2 run at the same time, maybe Test1's assertion would fail because Test2 would set classMember to 2 before Test1 asserts that classMember = 1. Is this an issue, and if so, what is the best practice for handling it?
Thanks!
[Parallelizable]
. docs.nunit.org/articles/nunit/writing-tests/attributes/…