namespace StarterNG.Tests.Fakes; /// A stream read from its start to its end and no other way: no length, no seeking. internal sealed class ForwardOnlyStream(Stream inner) : Stream { public override bool CanRead => true; public override bool CanSeek => false; public override bool CanWrite => false; public override long Length => throw new NotSupportedException(); public override long Position { get => throw new NotSupportedException(); set => throw new NotSupportedException(); } public override int Read(byte[] buffer, int offset, int count) => inner.Read(buffer, offset, count); public override long Seek(long offset, SeekOrigin origin) => throw new NotSupportedException(); public override void SetLength(long value) => throw new NotSupportedException(); public override void Write(byte[] buffer, int offset, int count) => throw new NotSupportedException(); public override void Flush() { } protected override void Dispose(bool disposing) { if (disposing) inner.Dispose(); base.Dispose(disposing); } }