< Summary

Class:Azure.Storage.Blobs.Specialized.BatchPipelineTransport
Assembly:Azure.Storage.Blobs.Batch
File(s):C:\Git\azure-sdk-for-net\sdk\storage\Azure.Storage.Blobs.Batch\src\BatchPipelineTransport.cs
Covered lines:6
Uncovered lines:0
Coverable lines:6
Total lines:50
Line coverage:100% (6 of 6)
Covered branches:1
Total branches:2
Branch coverage:50% (1 of 2)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-100%50%
CreateRequest()-100%100%
Process(...)-100%100%
ProcessAsync()-100%100%
SetResponse(...)-100%100%

File(s)

C:\Git\azure-sdk-for-net\sdk\storage\Azure.Storage.Blobs.Batch\src\BatchPipelineTransport.cs

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License.
 3
 4using System;
 5using System.Threading.Tasks;
 6using Azure.Core;
 7using Azure.Core.Pipeline;
 8
 9namespace Azure.Storage.Blobs.Specialized
 10{
 11    /// <summary>
 12    /// BatchPipelineTransport is an empty transport protocol that never sends
 13    /// anything over the wire.  It allows batch sub-operations to run through
 14    /// a pipeline to and have policies like Authentication prepare the Request.
 15    /// </summary>
 16    internal class BatchPipelineTransport : HttpPipelineTransport
 17    {
 18        /// <summary>
 19        /// We cache the original pipeline used to create the BlobBatchClient
 20        /// so we can create the same type of Request objects.
 21        /// </summary>
 22        private readonly HttpPipeline _original;
 23
 24        /// <summary>
 25        /// Creates a new instance of the <see cref="BatchPipelineTransport"/>
 26        /// class.
 27        /// </summary>
 28        /// <param name="originalPipeline">
 29        /// The original pipeline used to create the BlobBatchClient.
 30        /// </param>
 11631        public BatchPipelineTransport(HttpPipeline originalPipeline) =>
 11632            _original = originalPipeline ?? throw new ArgumentNullException(nameof(originalPipeline));
 33
 34        /// <inheritdoc />
 232435        public override Request CreateRequest() => _original.CreateRequest();
 36
 37        /// <inheritdoc />
 38        public override void Process(HttpMessage message) =>
 115239            SetResponse(message);
 40
 41#pragma warning disable CS1998 // Async method lacks 'await' operators and will run synchronously
 42        /// <inheritdoc />
 43        public override async ValueTask ProcessAsync(HttpMessage message) =>
 115244            SetResponse(message);
 45#pragma warning restore CS1998 // Async method lacks 'await' operators and will run synchronously
 46
 47        private static void SetResponse(HttpMessage message) =>
 230448            message.Response = new MemoryResponse();
 49    }
 50}