public async Task ReadAsync_1GB_WithReadOnlyMemory()
        {
            long memoryStart;
            long memoryEnd;
            var buffersRead = 0L;

            var length = (1L * Constants.GB) - (1 * Constants.MB) - (1 * Constants.KB);

            using (var expectedStream = new MockNonSeekableStream(length))
            using (var reader = new StreamPartitioner(expectedStream))
            {
                memoryStart = GC.GetTotalMemory(true);

                Assert.IsTrue(expectedStream.CanRead);
                Assert.IsFalse(expectedStream.CanSeek);

                do
                {
                    var position = expectedStream.Position;
                    using (var buffer = await reader.ReadAsync())
                    {
                        if (buffer.Length == 0)
                        {
                            Assert.AreEqual(expectedStream.Length, expectedStream.Position);
                            break;
                        }
                        else
                        {
                            buffersRead++;

                            Assert.IsTrue(buffer.CanRead);
                            Assert.IsTrue(buffer.CanSeek);
                            
                            buffer.Read(out var memory, (int)buffer.Length);

                            Assert.AreEqual((int)buffer.Length, memory.Length);
                        }
                    }

                    Assert.IsTrue(GC.GetTotalMemory(true) - memoryStart < 8 * Constants.DEFAULT_BUFFER_SIZE); // TODO Assuming at most 8 buffers allocated
                }
                while (true);
            }

            memoryEnd = GC.GetTotalMemory(true);

            //logger.LogInformation($"{buffersRead} buffers read");
            //logger.LogInformation($"{nameof(memoryStart)} = {memoryStart}; {nameof(memoryEnd)} = {memoryEnd}");
            //logger.LogInformation($"delta = {memoryEnd - memoryStart}");

            Assert.AreEqual(Math.Ceiling(1d * length / Constants.DEFAULT_BUFFER_SIZE), buffersRead);
            Assert.IsTrue(memoryEnd - memoryStart < 8 * Constants.DEFAULT_BUFFER_SIZE); // TODO Assuming at most 8 buffers allocated
        }
        public async Task GetNextPartitionAsync_1GB()
        {
            long memoryStart;
            long memoryEnd;
            var  buffersRead = 0L;

            var length = (1L * Constants.GB) - (1 * Constants.MB) - (1 * Constants.KB);

            using (var expectedStream = new MockNonSeekableStream(length))
                using (var reader = new StreamPartitioner(expectedStream))
                {
                    memoryStart = GC.GetTotalMemory(true);

                    Assert.IsTrue(expectedStream.CanRead);
                    Assert.IsFalse(expectedStream.CanSeek);

                    do
                    {
                        var position = expectedStream.Position;
                        using (StreamPartition buffer = await reader.GetNextPartitionAsync())
                        {
                            if (buffer.Length == 0)
                            {
                                Assert.AreEqual(expectedStream.Length, expectedStream.Position);
                                break;
                            }
                            else
                            {
                                buffersRead++;

                                Assert.IsTrue(buffer.CanRead);
                                Assert.IsTrue(buffer.CanSeek);
                            }
                        }

                        Assert.IsTrue(GC.GetTotalMemory(true) - memoryStart < 8 * Storage.Constants.DefaultBufferSize); // TODO Assuming at most 8 buffers allocated
                    }while (true);
                }

            memoryEnd = GC.GetTotalMemory(true);

            //logger.LogInformation($"{buffersRead} buffers read");
            //logger.LogInformation($"{nameof(memoryStart)} = {memoryStart}; {nameof(memoryEnd)} = {memoryEnd}");
            //logger.LogInformation($"delta = {memoryEnd - memoryStart}");

            Assert.AreEqual(Math.Ceiling(1d * length / Storage.Constants.DefaultBufferSize), buffersRead);
            Assert.IsTrue(memoryEnd - memoryStart < 8 * Storage.Constants.DefaultBufferSize); // TODO Assuming at most 8 buffers allocated
        }