Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A few points for Task<> and IAsyncEnumerable<> support on *Source attributes #836

Merged
merged 1 commit into from
Nov 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ It has the following characteristics:
* It **must** be static. This is a change from NUnit 2.x.
* It must return an `IEnumerable` or a type that implements `IEnumerable`. For fields an array is generally used. For
properties and methods, you may return an array or implement your own iterator.
* Methods may also return an `IAsyncEnumerable` or a type that implements `IAsyncEnumerable`. (_NUnit 4+_)
* Methods may be async by wrapping the return type in a `Task<T>`. (_NUnit 3.14+_)
* The individual items returned by the enumerator must be compatible with the signature of the method on which the
attribute appears. See the **Test Case Construction** section below for details.

Expand All @@ -53,6 +55,8 @@ characteristics:
* It **must** be static. This is a change from NUnit 2.x.
* It must return an `IEnumerable` or a type that implements `IEnumerable`. For fields an array is generally used. For
properties and methods, you may return an array or implement your own iterator.
* Methods may also return an `IAsyncEnumerable` or a type that implements `IAsyncEnumerable`. (_NUnit 4+_)
* Methods may be async by wrapping the return type in a `Task<T>`. (_NUnit 3.14+_)
* The individual items returned by the enumerator must be compatible with the signature of the method on which the
attribute appears. See the **Test Case Construction** section below for details.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ constructing the `TestFixture`. It has the following characteristics:
* It **must** be static.
* It must return an `IEnumerable` or a type that implements `IEnumerable`. For fields an array is generally used. For
properties and methods, you may return an array or implement your own iterator.
* Methods may also return an `IAsyncEnumerable` or a type that implements `IAsyncEnumerable`. (_NUnit 4+_)
* Methods may be async by wrapping the return type in a `Task<T>`. (_NUnit 3.14+_)
* The individual items returned by the enumerator must either be object arrays or derive from the
`TestFixtureParameters` class. Arguments must be consistent with the fixture constructor.

Expand Down Expand Up @@ -66,6 +68,8 @@ characteristics:
* It **must** be static.
* It must return an `IEnumerable` or a type that implements `IEnumerable`. For fields an array is generally used. For
properties and methods, you may return an array or implement your own iterator.
* Methods may also return an `IAsyncEnumerable` or a type that implements `IAsyncEnumerable`. (_NUnit 4+_)
* Methods may be async by wrapping the return type in a `Task<T>`. (_NUnit 3.14+_)
* The individual items returned by the enumerator must either be object arrays or derive from the
`TestFixtureParameters` class. Arguments must be consistent with the fixture constructor.

Expand Down
4 changes: 3 additions & 1 deletion docs/articles/nunit/writing-tests/attributes/valuesource.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ characteristics:

* It may be a field, a non-indexed property or a method taking no arguments.
* It must be a static member.
* It must return an IEnumerable or a type that implements IEnumerable.
* It must return an `IEnumerable` or a type that implements `IEnumerable`.
* Methods may also return an `IAsyncEnumerable` or a type that implements `IAsyncEnumerable`. (_NUnit 4+_)
* Methods may be async by wrapping the return type in a `Task<T>`. (_NUnit 3.14+_)
* The individual items returned from the enumerator must be compatible with the type of the parameter on which the
attribute appears.

Expand Down