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 | 912455ac19161533205c2fe56b91ff4595ea4fdb (patch) | |
tree | b8ddc07077f9ac767a27f811db4f20ba88cc5087 /Timeline.Tests/Helpers/AsyncFunctionAssertionsExtensions.cs | |
parent | 89c106169bd2a16310fdaa6e0c48a3402d97de3a (diff) | |
download | timeline-912455ac19161533205c2fe56b91ff4595ea4fdb.tar.gz timeline-912455ac19161533205c2fe56b91ff4595ea4fdb.tar.bz2 timeline-912455ac19161533205c2fe56b91ff4595ea4fdb.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);
+ }
+ }
+}
|