您可以在 AutoFixture 中将内联值与 AutoData 结合使用吗?

Can you combine inlined values with AutoData in AutoFixture?

我将 NUnit3 和 AutoFixture 与 AutoDataAttribute 一起使用,如下所示:

[Test, AutoData]
public async Task Should_Filter_By_Date_Range_Only(Generator<AbpAuditLogs> generator)
{
    var startDate = new DateTime(2015, 1, 1);
    var endDate = new DateTime(2018, 1, 1);
    var logs = generator.Take(20).ToList();
    logs[5].ExecutionTime = GetRandomDateBetween(startDate, endDate);
}

我如何提供来自内联值的数据以及来自 AutoFixture 的自动生成的数据?

// Pseudo-code
// TestCase(1, 2, <some auto generated list here>)

您可能想看看 InlineAutoDataAttribute。可以找到一些带有 NUnit3 示例的 AutoFixture here