Skip to content

TestCaseSource to recognize new async streams #3391

Closed
@SavchukSergey

Description

@SavchukSergey

Would be nice to have support new .net core 3.0 async streams feature.

[Test, TestCaseSource(nameof(EnumerateAsync))]
public void AsyncStreamTest(object val) {
    Assert.IsNotNull(val);
}

public static async IAsyncEnumerable<object> EnumerateAsync()  {
    yield return await Create();
    yield return await Create();
}

public static Task<object> Create() {
    return Task.FromResult(new object());
}

Currently it says:

  X AsyncStreamTest [< 1ms]
  Error Message:
   System.InvalidCastException : Unable to cast object of type '<EnumerateAsync>d__1' to type 'System.Collections.IEnumerable'.
  Stack Trace:
     at NUnit.Framework.TestCaseSourceAttribute.GetTestCaseSource(IMethodInfo method)
   at NUnit.Framework.TestCaseSourceAttribute.GetTestCasesFor(IMethodInfo method)

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions