< Summary

Class:Azure.Storage.StreamExtensions
Assembly:Azure.Storage.Files.Shares
File(s):C:\Git\azure-sdk-for-net\sdk\storage\Azure.Storage.Common\src\Shared\NonDisposingStream.cs
Covered lines:1
Uncovered lines:0
Coverable lines:1
Total lines:53
Line coverage:100% (1 of 1)
Covered branches:1
Total branches:2
Branch coverage:50% (1 of 2)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
WithNoDispose(...)-100%50%

File(s)

C:\Git\azure-sdk-for-net\sdk\storage\Azure.Storage.Common\src\Shared\NonDisposingStream.cs

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License.
 3
 4using System.IO;
 5using System.Threading;
 6using System.Threading.Tasks;
 7
 8#pragma warning disable SA1402  // File may only contain a single type
 9
 10namespace Azure.Storage
 11{
 12    internal class NonDisposingStream : Stream
 13    {
 14        private readonly Stream _innerStream;
 15
 16        public NonDisposingStream(Stream innerStream) => _innerStream = innerStream;
 17
 18        public override bool CanRead => _innerStream.CanRead;
 19
 20        public override bool CanSeek => _innerStream.CanSeek;
 21
 22        public override bool CanWrite => _innerStream.CanWrite;
 23
 24        public override Task CopyToAsync(Stream destination, int bufferSize, CancellationToken cancellationToken) => _in
 25
 26        public override long Length => _innerStream.Length;
 27
 28        public override long Position { get => _innerStream.Position; set => _innerStream.Position = value; }
 29
 30        public override void Flush() => _innerStream.Flush();
 31
 32        public override Task FlushAsync(CancellationToken cancellationToken) => _innerStream.FlushAsync(cancellationToke
 33
 34        public override int Read(byte[] buffer, int offset, int count) => _innerStream.Read(buffer, offset, count);
 35
 36        public override Task<int> ReadAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken) =
 37
 38        public override long Seek(long offset, SeekOrigin origin) => _innerStream.Seek(offset, origin);
 39
 40        public override void SetLength(long value) => _innerStream.SetLength(value);
 41
 42        public override void Write(byte[] buffer, int offset, int count) => _innerStream.Write(buffer, offset, count);
 43
 44        public override Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken) => _i
 45
 46        protected override void Dispose(bool disposing) { /* swallow disposal */ }
 47    }
 48
 49    internal static partial class StreamExtensions
 50    {
 130051        public static Stream WithNoDispose(this Stream stream) => stream is NonDisposingStream ? stream : new NonDisposi
 52    }
 53}

Methods/Properties

WithNoDispose(...)