Skip to content

Commit ab95da0

Browse files
committed
Fix compilation issue with test on .NET Framework
1 parent 9d03476 commit ab95da0

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

src/Lucene.Net.Tests/Support/IO/TestStreamExtensions.cs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -205,17 +205,23 @@ public async Task TestReadExactlyAsync_Success_IntoMiddle()
205205
}
206206

207207
[Test]
208-
public void TestReadExactlyAsync_EndOfStream()
208+
public async Task TestReadExactlyAsync_EndOfStream()
209209
{
210210
var bytes = new byte[] { 1, 2, 3, 4 };
211211

212-
Assert.ThrowsAsync<EndOfStreamException>(async () =>
212+
try
213213
{
214214
using var ms = new MemoryStream(bytes);
215215

216216
var buffer = new byte[5];
217217
await ms.ReadExactlyAsync(buffer, 0, 5);
218-
});
218+
219+
Assert.Fail("Should have thrown an exception");
220+
}
221+
catch (EndOfStreamException)
222+
{
223+
Assert.Pass("Expected EndOfStreamException thrown");
224+
}
219225
}
220226

221227
[Test]

0 commit comments

Comments
 (0)