aboutsummaryrefslogtreecommitdiff
path: root/Timeline.Tests/Helpers/AsyncFunctionAssertionsExtensions.cs
blob: 516c34e9eb733e6051c035a86d301d901ac3f8c5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
using FluentAssertions;
using FluentAssertions.Primitives;
using FluentAssertions.Specialized;
using System;
using System.Threading.Tasks;

namespace TimelineApp.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);
        }
    }
}