byte[] readBuffer = new byte[buffer.Length];
for (long i = 0; i < SizeInMb; i++)
{
- int actualRead = partStream.Read(readBuffer, 0, readBuffer.Length);
+ int totalRead = 0;
+ while (totalRead < readBuffer.Length)
+ {
+ int actualRead = partStream.Read(readBuffer, totalRead, readBuffer.Length - totalRead);
+ Assert.InRange(actualRead, 1, readBuffer.Length - totalRead);
+ totalRead += actualRead;
+ }
- Assert.Equal(actualRead, readBuffer.Length);
+ Assert.Equal(readBuffer.Length, totalRead);
Assert.True(buffer.AsSpan().SequenceEqual(readBuffer));
}
}