< Summary

Class:Azure.Storage.Blobs.Specialized.BatchErrors
Assembly:Azure.Storage.Blobs.Batch
File(s):C:\Git\azure-sdk-for-net\sdk\storage\Azure.Storage.Blobs.Batch\src\BatchErrors.cs
Covered lines:5
Uncovered lines:7
Coverable lines:12
Total lines:54
Line coverage:41.6% (5 of 12)
Covered branches:0
Total branches:0

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
UseDelayedResponseEarly()-100%100%
CannotResubmitBatch(...)-0%100%
BatchClientDoesNotMatch(...)-100%100%
CannotSubmitEmptyBatch(...)-100%100%
BatchAlreadySubmitted()-0%100%
OnlyHomogenousOperationsAllowed(...)-100%100%
UnexpectedResponseCount(...)-0%100%
ResponseFailures(...)-100%100%
InvalidBatchContentType(...)-0%100%
InvalidHttpStatusLine(...)-0%100%
InvalidHttpHeaderLine(...)-0%100%
InvalidResponse(...)-0%100%

File(s)

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

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License.
 3
 4using System;
 5using System.Collections.Generic;
 6using System.Globalization;
 7using Azure.Core;
 8using Azure.Core.Pipeline;
 9
 10namespace Azure.Storage.Blobs.Specialized
 11{
 12    /// <summary>
 13    /// Errors raised by the batching APIs.
 14    /// </summary>
 15    internal static class BatchErrors
 16    {
 17        public static InvalidOperationException UseDelayedResponseEarly() =>
 418            new InvalidOperationException($"Cannot use the {nameof(Response)} before calling {nameof(BlobBatchClient)}.{
 19
 20        public static ArgumentException CannotResubmitBatch(string argumentName) =>
 021            new ArgumentException($"Cannot submit a batch that has already been submitted.", argumentName);
 22
 23        public static ArgumentException BatchClientDoesNotMatch(string argumentName) =>
 424            new ArgumentException($"The {nameof(BlobBatchClient)} used to create the {nameof(BlobBatch)} must be used to
 25
 26        public static ArgumentException CannotSubmitEmptyBatch(string argumentName) =>
 427            new ArgumentException($"Cannot submit an empty batch.", argumentName);
 28
 29        public static InvalidOperationException BatchAlreadySubmitted() =>
 030            new InvalidOperationException($"Cannot modify a batch that has already been submitted.");
 31
 32        public static InvalidOperationException OnlyHomogenousOperationsAllowed(BlobBatchOperationType operationType) =>
 833            new InvalidOperationException($"{nameof(BlobBatch)} only supports one operation type per batch and is alread
 34
 35        public static InvalidOperationException UnexpectedResponseCount(int expected, int actual) =>
 036            new InvalidOperationException($"Expected {expected.ToString(CultureInfo.InvariantCulture)} responses for the
 37
 38        public static AggregateException ResponseFailures(IList<Exception> failures) =>
 3239            new AggregateException($"{failures.Count.ToString(CultureInfo.InvariantCulture)} batch operation(s) failed."
 40
 41        public static InvalidOperationException InvalidBatchContentType(string contentType) =>
 042            new InvalidOperationException($"Expected {HttpHeader.Names.ContentType} to start with {BatchConstants.Multip
 43
 44        public static InvalidOperationException InvalidHttpStatusLine(string statusLine) =>
 045            new InvalidOperationException($"Expected an HTTP status line, not {statusLine}");
 46
 47        public static InvalidOperationException InvalidHttpHeaderLine(string headerLine) =>
 048            new InvalidOperationException($"Expected an HTTP header line, not {headerLine}");
 49
 50        public static RequestFailedException InvalidResponse(ClientDiagnostics clientDiagnostics, Response response, Exc
 051            clientDiagnostics.CreateRequestFailedExceptionWithContent(response, message: "Invalid response", innerExcept
 52
 53    }
 54}