public void CacheTruncatedOnTruncateCall()
        {
            var sourceStream = new MemoryStream();

            var sourceData = new byte[] { 1, 2, 3, 4, 5, 6 };

            sourceStream.Write(sourceData, 0, sourceData.Length);

            sourceStream.Position = 0;

            var memoryStreamCacheAccessor = new MemoryStreamCacheAccessor();

            var rewindable = new RewindableBuilder(sourceStream).SetCacheAccessor(memoryStreamCacheAccessor).Build();

            var outputData = new byte[sourceData.Length];

            rewindable.Stream.Read(outputData, 0, outputData.Length);

            rewindable.Truncate(1);

            Assert.IsTrue(memoryStreamCacheAccessor.Stream.ToArray().SequenceEqual(new byte[] { 6 }));
        }
        public void CacheTruncatedToAutoTruncationTailLengthToAccommodateNewDataWhenAutoTruncateAtBytesPassed()
        {
            var sourceStream = new MemoryStream();

            var sourceData = new byte[] { 1, 2, 3, 4, 5, 6 };

            sourceStream.Write(sourceData, 0, sourceData.Length);

            sourceStream.Position = 0;

            var memoryStreamCacheAccessor = new MemoryStreamCacheAccessor();

            var rewindable = new RewindableBuilder(sourceStream).SetCacheAccessor(memoryStreamCacheAccessor)
                .SetAutoTruncateAtBytes(4).SetAutoTruncationTailLength(0).Build();

            var outputData = new byte[sourceData.Length];

            rewindable.Stream.Read(outputData, 0, outputData.Length);

            Assert.IsTrue(memoryStreamCacheAccessor.Stream.ToArray().SequenceEqual(new byte[] { 5, 6 }));
        }