diff --git a/test/OrchardCore.Tests/Utilities/FileInfoExtensions.cs b/test/OrchardCore.Tests/Utilities/FileInfoExtensions.cs index 5eab13e5f95..ec64d166a35 100644 --- a/test/OrchardCore.Tests/Utilities/FileInfoExtensions.cs +++ b/test/OrchardCore.Tests/Utilities/FileInfoExtensions.cs @@ -1,17 +1,22 @@ -namespace OrchardCore.Tests.Utilities +namespace OrchardCore.Tests.Utilities; + +public static class FileInfoExtensions { - public static class FileInfoExtensions + public static string ReadToEnd(this IFileInfo fileInfo) { - public static string ReadToEnd(this IFileInfo fileInfo) - => ReadToEndAsync(fileInfo).GetAwaiter().GetResult(); + using var stream = fileInfo.CreateReadStream(); + + using var streamReader = new StreamReader(stream); - public static async Task ReadToEndAsync(this IFileInfo fileInfo) - { - await using var stream = fileInfo.CreateReadStream(); + return streamReader.ReadToEnd(); + } + + public static async Task ReadToEndAsync(this IFileInfo fileInfo) + { + await using var stream = fileInfo.CreateReadStream(); - using var streamReader = new StreamReader(stream); + using var streamReader = new StreamReader(stream); - return await streamReader.ReadToEndAsync(); - } + return await streamReader.ReadToEndAsync(); } }