2024-03-28 13:46:12 +01:00
|
|
|
|
using Bit.Core.Billing;
|
2024-02-09 17:58:37 +01:00
|
|
|
|
using Xunit;
|
|
|
|
|
|
|
|
|
|
using static Bit.Core.Billing.Utilities;
|
|
|
|
|
|
|
|
|
|
namespace Bit.Core.Test.Billing;
|
|
|
|
|
|
|
|
|
|
public static class Utilities
|
|
|
|
|
{
|
2024-04-25 17:07:47 +02:00
|
|
|
|
public static async Task ThrowsContactSupportAsync(
|
|
|
|
|
Func<Task> function,
|
|
|
|
|
string internalMessage = null,
|
|
|
|
|
Exception innerException = null)
|
2024-02-09 17:58:37 +01:00
|
|
|
|
{
|
2024-04-25 17:07:47 +02:00
|
|
|
|
var contactSupport = ContactSupport(internalMessage, innerException);
|
2024-02-09 17:58:37 +01:00
|
|
|
|
|
2024-03-28 13:46:12 +01:00
|
|
|
|
var exception = await Assert.ThrowsAsync<BillingException>(function);
|
2024-02-09 17:58:37 +01:00
|
|
|
|
|
2024-04-25 17:07:47 +02:00
|
|
|
|
Assert.Equal(contactSupport.ClientFriendlyMessage, exception.ClientFriendlyMessage);
|
2024-02-09 17:58:37 +01:00
|
|
|
|
Assert.Equal(contactSupport.Message, exception.Message);
|
2024-04-25 17:07:47 +02:00
|
|
|
|
Assert.Equal(contactSupport.InnerException, exception.InnerException);
|
2024-02-09 17:58:37 +01:00
|
|
|
|
}
|
|
|
|
|
}
|