public static async IAsyncEnumerable<TestCaseData> AsyncEnumerableTestCases()
{
await Task.Delay(100); // Simulate an asynchronous operation
yield return new TestCaseData(42, 42);
await Task.Delay(100); // Simulate another asynchronous operation
yield return new TestCaseData(51, 51);
}
[TestCaseSource(nameof(AsyncEnumerableTestCases))]
public async Task TestAsyncEnumerable(int expected, int actual)
{
await Task.Delay(100); // Simulate an asynchronous operation
actual.Should().Be(expected);
}
System.NotSupportedException : Specified method is not supported.
.AsyncEnumerableTestCases()+System.IAsyncDisposable.DisposeAsync()
at NUnit.Framework.Internal.AsyncEnumerableAdapter.AsyncEnumeratorWrapper.<Dispose>b__4_0()
at NUnit.Framework.Internal.AsyncToSyncAdapter.Await[TResult](Func`1 invoke)
at NUnit.Framework.Internal.AsyncToSyncAdapter.Await(Func`1 invoke)
at NUnit.Framework.Internal.AsyncEnumerableAdapter.AsyncEnumeratorWrapper.Dispose()
at NUnit.Framework.TestCaseSourceAttribute.GetTestCasesFor(IMethodInfo method)
Example test case
Error
Notes:
nUnit 4.2.0, and looks like the feature added in AsyncEnumerable support for TestCaseSource, ValueSource, and TestFixtureSource #4538 regressed.