Skip to content

Commit

Permalink
Merge pull request #836 from stevenaw/iasync-enumerable
Browse files Browse the repository at this point in the history
A few points for Task<> and IAsyncEnumerable<> support on *Source attributes f59fe5b
  • Loading branch information
stevenaw committed Nov 11, 2023
1 parent 71de27a commit 9306e6b
Show file tree
Hide file tree
Showing 5 changed files with 392 additions and 367 deletions.
14 changes: 12 additions & 2 deletions articles/nunit/writing-tests/attributes/testcasesource.html
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,12 @@ <h5>Note</h5>
<li>It may be a field, property or method in the test class.</li>
<li>It <strong>must</strong> be static. This is a change from NUnit 2.x.</li>
<li>It must return an <code>IEnumerable</code> or a type that implements <code>IEnumerable</code>. For fields an array is generally used. For
properties and methods, you may return an array or implement your own iterator.</li>
properties and methods, you may return an array or implement your own iterator.
<ul>
<li>Methods may also return an <code>IAsyncEnumerable</code> or a type that implements <code>IAsyncEnumerable</code>. (<em>NUnit 4+</em>)</li>
<li>Methods may be async by wrapping the return type in a <code>Task&lt;T&gt;</code>. (<em>NUnit 3.14+</em>)</li>
</ul>
</li>
<li>The individual items returned by the enumerator must be compatible with the signature of the method on which the
attribute appears. See the <strong>Test Case Construction</strong> section below for details.</li>
</ul>
Expand Down Expand Up @@ -192,7 +197,12 @@ <h5>Note</h5>
<li>It may be a field, property or method in the test class.</li>
<li>It <strong>must</strong> be static. This is a change from NUnit 2.x.</li>
<li>It must return an <code>IEnumerable</code> or a type that implements <code>IEnumerable</code>. For fields an array is generally used. For
properties and methods, you may return an array or implement your own iterator.</li>
properties and methods, you may return an array or implement your own iterator.
<ul>
<li>Methods may also return an <code>IAsyncEnumerable</code> or a type that implements <code>IAsyncEnumerable</code>. (<em>NUnit 4+</em>)</li>
<li>Methods may be async by wrapping the return type in a <code>Task&lt;T&gt;</code>. (<em>NUnit 3.14+</em>)</li>
</ul>
</li>
<li>The individual items returned by the enumerator must be compatible with the signature of the method on which the
attribute appears. See the <strong>Test Case Construction</strong> section below for details.</li>
</ul>
Expand Down
14 changes: 12 additions & 2 deletions articles/nunit/writing-tests/attributes/testfixturesource.html
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,12 @@ <h3 id="form-1---testfixturesourcestring-sourcename">Form 1 - [TestFixtureSource
<li>It may be a field, property or method in the test class.</li>
<li>It <strong>must</strong> be static.</li>
<li>It must return an <code>IEnumerable</code> or a type that implements <code>IEnumerable</code>. For fields an array is generally used. For
properties and methods, you may return an array or implement your own iterator.</li>
properties and methods, you may return an array or implement your own iterator.
<ul>
<li>Methods may also return an <code>IAsyncEnumerable</code> or a type that implements <code>IAsyncEnumerable</code>. (<em>NUnit 4+</em>)</li>
<li>Methods may be async by wrapping the return type in a <code>Task&lt;T&gt;</code>. (<em>NUnit 3.14+</em>)</li>
</ul>
</li>
<li>The individual items returned by the enumerator must either be object arrays or derive from the
<code>TestFixtureParameters</code> class. Arguments must be consistent with the fixture constructor.</li>
</ul>
Expand Down Expand Up @@ -140,7 +145,12 @@ <h3 id="form-2---testfixturesourcetype-sourcetype-string-sourcename">Form 2 - [T
<li>It may be a field, property or method in the test class.</li>
<li>It <strong>must</strong> be static.</li>
<li>It must return an <code>IEnumerable</code> or a type that implements <code>IEnumerable</code>. For fields an array is generally used. For
properties and methods, you may return an array or implement your own iterator.</li>
properties and methods, you may return an array or implement your own iterator.
<ul>
<li>Methods may also return an <code>IAsyncEnumerable</code> or a type that implements <code>IAsyncEnumerable</code>. (<em>NUnit 4+</em>)</li>
<li>Methods may be async by wrapping the return type in a <code>Task&lt;T&gt;</code>. (<em>NUnit 3.14+</em>)</li>
</ul>
</li>
<li>The individual items returned by the enumerator must either be object arrays or derive from the
<code>TestFixtureParameters</code> class. Arguments must be consistent with the fixture constructor.</li>
</ul>
Expand Down
7 changes: 6 additions & 1 deletion articles/nunit/writing-tests/attributes/valuesource.html
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,12 @@ <h1 id="valuesource">ValueSource</h1>
<ul>
<li>It may be a field, a non-indexed property or a method taking no arguments.</li>
<li>It must be a static member.</li>
<li>It must return an IEnumerable or a type that implements IEnumerable.</li>
<li>It must return an <code>IEnumerable</code> or a type that implements <code>IEnumerable</code>.
<ul>
<li>Methods may also return an <code>IAsyncEnumerable</code> or a type that implements <code>IAsyncEnumerable</code>. (<em>NUnit 4+</em>)</li>
<li>Methods may be async by wrapping the return type in a <code>Task&lt;T&gt;</code>. (<em>NUnit 3.14+</em>)</li>
</ul>
</li>
<li>The individual items returned from the enumerator must be compatible with the type of the parameter on which the
attribute appears.</li>
</ul>
Expand Down
Loading

0 comments on commit 9306e6b

Please sign in to comment.