public void StreamNotDisposed() { var cache = CreateCache(); var fileSize = 10 * 1024 * 1024; var stream = new AssertStream(fileSize, 42); cache.AddOrUpdateStream(123, stream, CancellationToken.None, null, leaveOpen: true); Assert.IsFalse(stream.Closed); Assert.IsFalse(stream.Disposed); }
public void StreamDisposed() { var cache = CreateCache(); var fileSize = 10 * 1024 * 1024; var stream = new AssertStream(fileSize, 42); using (var cachedStream = cache.GetStreamOrAddStream(123, _ => stream, CancellationToken.None, null)) { cachedStream.ReadByte(); } Assert.IsTrue(stream.Closed); Assert.IsTrue(stream.Disposed); }