-
Notifications
You must be signed in to change notification settings - Fork 178
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add async catch method (#430) * Only 4.5 and netstandard supported
- Loading branch information
1 parent
745ff75
commit 8d930f8
Showing
5 changed files
with
168 additions
and
19 deletions.
There are no files selected for viewing
40 changes: 40 additions & 0 deletions
40
src/Examples/Example.Random/AsyncSpecificationsValueTask.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
using System.Threading.Tasks; | ||
using Machine.Specifications; | ||
|
||
#if !NET45 | ||
namespace Example.Random | ||
{ | ||
public class AsyncSpecificationsValueTask | ||
{ | ||
public static int establish_value; | ||
|
||
public static int because_value; | ||
|
||
public static int async_it_value; | ||
|
||
public static int sync_it_value; | ||
|
||
public static int cleanup_value; | ||
|
||
public static ValueTask<int> Test() | ||
{ | ||
return new ValueTask<int>(10); | ||
} | ||
|
||
Establish context = async () => | ||
establish_value = await Test(); | ||
|
||
Because of = async () => | ||
because_value = await Test(); | ||
|
||
It should_invoke_sync = () => | ||
sync_it_value = Test().Result; | ||
|
||
It should_invoke_async = async () => | ||
async_it_value = await Test(); | ||
|
||
Cleanup after = async () => | ||
cleanup_value = await Test(); | ||
} | ||
} | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters