aboutsummaryrefslogtreecommitdiff
path: root/BackEnd/Timeline.Tests/Helpers/AsyncFunctionAssertionsExtensions.cs
blob: b78309c0bf41c1bbb6d6da66b2458c123d55c42f (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 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);
        }
    }
}