Skip to content

Commit 7b85ec1

Browse files
committed
test(MockFileStream): use Read return value to satisfy CA2022
The shared-contents regression test ignored the byte count returned by Stream.Read, which the analyzer flags as CA2022 (inexact read) and the build treats as an error. Capture the count and assert it equals the requested length.
1 parent 0f67cc9 commit 7b85ec1

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

tests/TestableIO.System.IO.Abstractions.TestingHelpers.Tests/MockFileStreamTests.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ public async Task MockFileStream_SharedReadWrite_SecondHandleSeesWritesFromFirst
3333

3434
file2.Position = 0;
3535
file2.Flush();
36-
file2.Read(buffer, 0, buffer.Length);
36+
var bytesRead = file2.Read(buffer, 0, buffer.Length);
37+
await That(bytesRead).IsEqualTo(buffer.Length);
3738
results.Add(BitConverter.ToInt32(buffer, 0));
3839
}
3940
}

0 commit comments

Comments
 (0)