1
0
mirror of https://github.com/bitwarden/server.git synced 2024-12-05 14:23:30 +01:00
bitwarden-server/test/Billing.Test/Utilities/EmbeddedResourceReader.cs
Alex Morask b2af73f00f
[PM-212] Sync Organization Billing Email from Stripe Webhook (#3305)
* Add StripeFacade and StripeEventService

* Add StripeEventServiceTests

* Handle customer.updated event in StripeController
2023-10-11 15:57:51 -04:00

23 lines
648 B
C#

using System.Reflection;
namespace Bit.Billing.Test.Utilities;
public static class EmbeddedResourceReader
{
public static async Task<string> ReadAsync(string resourceType, string fileName)
{
var assembly = Assembly.GetExecutingAssembly();
await using var stream = assembly.GetManifestResourceStream($"Bit.Billing.Test.Resources.{resourceType}.{fileName}");
if (stream == null)
{
throw new Exception($"Failed to retrieve manifest resource stream for file: {fileName}.");
}
using var reader = new StreamReader(stream);
return await reader.ReadToEndAsync();
}
}