public void Correct_ReadByte() { var arr = new byte[100000]; for (var i = 0; i < arr.Length; i++) { arr[i] = (byte)i; } var mem = new MemoryStream(arr); var bufreader = new BufferedOutputStream(mem); foreach (var e in arr) { Assert.Equal(e, bufreader.ReadByte()); } }
public void ReadByte_EOF_Well() { var arr = new byte[5000]; var mem = new MemoryStream(arr); var bufreader = new BufferedOutputStream(mem); int b = 0; int i = 0; while (true) { b = bufreader.ReadByte(); if (b != -1) { i++; } else { break; } } Assert.Equal(5000, i); }