예제 #1
0
        async Task AssertPipeWorksWithSizes(int pipeBufferSize, int dataSize)
        {
            var rand = new Random();
            var data = new byte[dataSize];

            rand.NextBytes(data);

            using (var subject = new PipeStream(pipeBufferSize))
                using (var bout = new MemoryStream()) {
                    var readOperation = subject.CopyToAsync(bout);
                    subject.Write(data, 0, data.Length);
                    subject.Dispose();
                    await readOperation;

                    AssertSameArrayContent(data, bout.ToArray(), "data written and read must be the same");
                }
        }
예제 #2
0
 public override Task CopyToAsync(Stream destination, int bufferSize, CancellationToken cancellationToken) => _underlying.CopyToAsync(destination, bufferSize, cancellationToken);