Below tests does not run independently which causes them to fail. In our case, we need to populate a database with relevant data for each case.
Is there a way to let each run on a 'clean' fixture?
[TestFixture]
public class TestSourceTest
{
int _sum = 0;
public class T
{
public int I { get; }
public T(int i)
{
I = i;
}
public override string ToString()
{
return I.ToString();
}
}
[TestCaseSource(nameof(TestCases))]
public void Test(T t)
{
_sum += t.I;
Assert.That(_sum, Is.EqualTo(t.I));
}
static IEnumerable<T> TestCases()
{
yield return new T(1);
yield return new T(2);
yield return new T(3);
}
}