-
-
Notifications
You must be signed in to change notification settings - Fork 96
Closed
Description
I am using version 0.53.0. I have a class injecting a collection of data that is filtered and used as input for inherited tests.
[InheritsTests]
public sealed class BugRecreationTest() : BugRecreationTestAbstract([1, 2, 3, 4, 5, 6, /*7*/ 8, 9]);public abstract class BugRecreationTestAbstract(IEnumerable<int> data)
{
public readonly IEnumerable<int> Seven = data.Where(d => d == 7);
public readonly IEnumerable<int> Odd = data.Where(d => d % 2 == 1);
public readonly IEnumerable<int> Even = data.Where(d => d % 2 == 0);
[Test]
[InstanceMethodDataSource(nameof(Even))]
public async Task EvenIsEven(int d) => await Assert.That(d).IsEven();
[Test]
[InstanceMethodDataSource(nameof(Seven))]
public async Task SevenIsSeven(int d) => await Assert.That(d).IsEqualTo(7);
[Test]
[InstanceMethodDataSource(nameof(Odd))]
public async Task OddIsOdd(int d) => await Assert.That(d).IsOdd();
}Here, even after rebuilding, deleting build and obj directories, etc. I get failing tests with Test instance is null for test OddIsOdd after instance creation. ClassInstance type: null at TUnit.Engine.Services.SingleTestExecutor.ExecuteTestInternalAsync(AbstractExecutableTest test, CancellationToken cancellationToken)l
I have other test where this issue also occurs, but where Odd would run, but Seven and Even would not. Perhaps that is only due to the order of execution for some reason.
Copilot
Metadata
Metadata
Assignees
Labels
No labels