diff options
author | 杨宇千 <crupest@outlook.com> | 2019-10-24 19:57:59 +0800 |
---|---|---|
committer | 杨宇千 <crupest@outlook.com> | 2019-10-24 19:57:59 +0800 |
commit | 280faac75b113d9a4bbecd7e4ea3499f1691ce61 (patch) | |
tree | b8ddc07077f9ac767a27f811db4f20ba88cc5087 /Timeline.Tests/Helpers/AsyncFunctionAssertionsExtensions.cs | |
parent | c324d1dad0ffc1a1013b22792078415e7a50c470 (diff) | |
download | timeline-280faac75b113d9a4bbecd7e4ea3499f1691ce61.tar.gz timeline-280faac75b113d9a4bbecd7e4ea3499f1691ce61.tar.bz2 timeline-280faac75b113d9a4bbecd7e4ea3499f1691ce61.zip |
...
Diffstat (limited to 'Timeline.Tests/Helpers/AsyncFunctionAssertionsExtensions.cs')
-rw-r--r-- | Timeline.Tests/Helpers/AsyncFunctionAssertionsExtensions.cs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/Timeline.Tests/Helpers/AsyncFunctionAssertionsExtensions.cs b/Timeline.Tests/Helpers/AsyncFunctionAssertionsExtensions.cs new file mode 100644 index 00000000..b78309c0 --- /dev/null +++ b/Timeline.Tests/Helpers/AsyncFunctionAssertionsExtensions.cs @@ -0,0 +1,16 @@ +using FluentAssertions;
+using FluentAssertions.Primitives;
+using FluentAssertions.Specialized;
+using System;
+using System.Threading.Tasks;
+
+namespace Timeline.Tests.Helpers
+{
+ public static class AsyncFunctionAssertionsExtensions
+ {
+ public static async Task<AndConstraint<ObjectAssertions>> ThrowAsync(this AsyncFunctionAssertions assertions, Type exceptionType, string because = "", params object[] becauseArgs)
+ {
+ return (await assertions.ThrowAsync<Exception>(because, becauseArgs)).Which.Should().BeAssignableTo(exceptionType);
+ }
+ }
+}
|