Skip to content

Commit d05f4a2

Browse files
committed
Update PolyfillTests_Compression.cs
1 parent b1e90d8 commit d05f4a2

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/Tests/PolyfillTests_Compression.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public async Task ExtractToDirectory_Extracts_All_Entries()
1212
var entry = archive.CreateEntry("test.txt");
1313
await using var stream = entry.Open();
1414
using var writer = new StreamWriter(stream);
15-
writer.Write("content");
15+
await writer.WriteAsync("content");
1616
}
1717

1818
memStream.Position = 0;
@@ -42,20 +42,20 @@ public async Task ExtractToDirectory_Overwrites_Existing_File_When_True()
4242
var entry = archive.CreateEntry("test.txt");
4343
await using var stream = entry.Open();
4444
using var writer = new StreamWriter(stream);
45-
writer.Write("new content");
45+
await writer.WriteAsync("new content");
4646
}
4747

4848
memStream.Position = 0;
4949
using var extractArchive = new ZipArchive(memStream, ZipArchiveMode.Read);
5050
var tempDir = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString());
5151
Directory.CreateDirectory(tempDir);
5252
var filePath = Path.Combine(tempDir, "test.txt");
53-
File.WriteAllText(filePath, "old content");
53+
await File.WriteAllTextAsync(filePath, "old content");
5454

5555
try
5656
{
5757
extractArchive.ExtractToDirectory(tempDir, overwriteFiles: true);
58-
await Assert.That(File.ReadAllText(filePath)).IsEqualTo("new content");
58+
await Assert.That(await File.ReadAllTextAsync(filePath)).IsEqualTo("new content");
5959
}
6060
finally
6161
{
@@ -103,7 +103,7 @@ public async Task ZipFile_ExtractToDirectoryAsync_ExtractsAllEntries()
103103
var entry = archive.CreateEntry("test.txt");
104104
await using var stream = entry.Open();
105105
using var writer = new StreamWriter(stream);
106-
writer.Write("async content");
106+
await writer.WriteAsync("async content");
107107
}
108108

109109
// Act
@@ -136,7 +136,7 @@ public async Task ZipFile_ExtractToDirectoryAsync_WithOverwrite_OverwritesFiles(
136136
var tempDir = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString());
137137
Directory.CreateDirectory(tempDir);
138138
var filePath = Path.Combine(tempDir, "test.txt");
139-
File.WriteAllText(filePath, "old content");
139+
await File.WriteAllTextAsync(filePath, "old content");
140140

141141
try
142142
{
@@ -153,7 +153,7 @@ public async Task ZipFile_ExtractToDirectoryAsync_WithOverwrite_OverwritesFiles(
153153
await ZipFile.ExtractToDirectoryAsync(tempArchive, tempDir, overwriteFiles: true);
154154

155155
// Assert
156-
await Assert.That(File.ReadAllText(filePath)).IsEqualTo("new content");
156+
await Assert.That(await File.ReadAllTextAsync(filePath)).IsEqualTo("new content");
157157
}
158158
finally
159159
{
@@ -184,7 +184,7 @@ public async Task ZipFile_ExtractToDirectoryAsync_WithEncoding_ExtractsCorrectly
184184
var entry = archive.CreateEntry("test.txt");
185185
await using var stream = entry.Open();
186186
using var writer = new StreamWriter(stream);
187-
writer.Write("encoded content");
187+
await writer.WriteAsync("encoded content");
188188
}
189189

190190
// Act
@@ -193,7 +193,7 @@ public async Task ZipFile_ExtractToDirectoryAsync_WithEncoding_ExtractsCorrectly
193193
// Assert
194194
var filePath = Path.Combine(tempDir, "test.txt");
195195
await Assert.That(File.Exists(filePath)).IsTrue();
196-
await Assert.That(File.ReadAllText(filePath)).IsEqualTo("encoded content");
196+
await Assert.That(await File.ReadAllTextAsync(filePath)).IsEqualTo("encoded content");
197197
}
198198
finally
199199
{

0 commit comments

Comments
 (0)