public void Can_memorize_large_stream() { var stream = CreateStream(100000); var length = 90000; var fs = new FirkinStream(new StreamSyncRoot(), stream, 1000, length); fs.Memorize(); Assert.IsTrue(fs.IsMemorized); var bytes = fs.ReadBytes(); Assert.AreEqual(length, bytes.Length); stream.Position = 1000; Assert.AreEqual(0, stream.ReadBytes(length).Compare(bytes)); }
public void Can_read_large_stream_directly_as_single_chunk() { var stream = CreateStream(100000); var length = 90000; var fs = new FirkinStream(new StreamSyncRoot(), stream, 1000, length); Assert.IsFalse(fs.IsMemorized); _log.Debug("starting read"); var bytes = fs.ReadBytes(); Assert.AreEqual(length, bytes.Length); stream.Position = 1000; Assert.AreEqual(0, stream.ReadBytes(length).Compare(bytes)); }