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