aboutsummaryrefslogtreecommitdiff
path: root/Timeline.Tests/Helpers/AsyncFunctionAssertionsExtensions.cs
diff options
context:
space:
mode:
author杨宇千 <crupest@outlook.com>2019-10-24 19:57:59 +0800
committer杨宇千 <crupest@outlook.com>2019-10-24 19:57:59 +0800
commit280faac75b113d9a4bbecd7e4ea3499f1691ce61 (patch)
treeb8ddc07077f9ac767a27f811db4f20ba88cc5087 /Timeline.Tests/Helpers/AsyncFunctionAssertionsExtensions.cs
parentc324d1dad0ffc1a1013b22792078415e7a50c470 (diff)
downloadtimeline-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.cs16
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);
+ }
+ }
+}