Esempio n. 1
0
        public async Task CanAdvanceWithPartialConsumptionOfFirstSegment(int firstWriteLength)
        {
            Writer = new StreamPipeWriter(Stream, MinimumSegmentSize, new TestMemoryPool(maxBufferSize: 20000));
            await Writer.WriteAsync(Encoding.ASCII.GetBytes("a"));

            var memory = Writer.GetMemory(firstWriteLength);

            Writer.Advance(firstWriteLength);

            memory = Writer.GetMemory();
            Writer.Advance(memory.Length);

            await Writer.FlushAsync();

            Assert.Equal(firstWriteLength + memory.Length + 1, Read().Length);
        }