2024-03-28 13:46:12 +01:00
|
|
|
|
using Bit.Core.Billing;
|
2024-02-09 17:58:37 +01:00
|
|
|
|
using Xunit;
|
|
|
|
|
|
|
|
|
|
namespace Bit.Core.Test.Billing;
|
|
|
|
|
|
|
|
|
|
public static class Utilities
|
|
|
|
|
{
|
2024-07-31 15:26:44 +02:00
|
|
|
|
public static async Task ThrowsBillingExceptionAsync(
|
2024-04-25 17:07:47 +02:00
|
|
|
|
Func<Task> function,
|
2024-07-31 15:26:44 +02:00
|
|
|
|
string response = null,
|
|
|
|
|
string message = null,
|
2024-04-25 17:07:47 +02:00
|
|
|
|
Exception innerException = null)
|
2024-02-09 17:58:37 +01:00
|
|
|
|
{
|
2024-07-31 15:26:44 +02:00
|
|
|
|
var expected = new BillingException(response, message, innerException);
|
2024-02-09 17:58:37 +01:00
|
|
|
|
|
2024-07-31 15:26:44 +02:00
|
|
|
|
var actual = await Assert.ThrowsAsync<BillingException>(function);
|
2024-02-09 17:58:37 +01:00
|
|
|
|
|
2024-07-31 15:26:44 +02:00
|
|
|
|
Assert.Equal(expected.Response, actual.Response);
|
|
|
|
|
Assert.Equal(expected.Message, actual.Message);
|
|
|
|
|
Assert.Equal(expected.InnerException, actual.InnerException);
|
2024-02-09 17:58:37 +01:00
|
|
|
|
}
|
|
|
|
|
}
|