< Summary

Class:Azure.Storage.Blobs.BlobErrors
Assembly:Azure.Storage.Blobs
File(s):C:\Git\azure-sdk-for-net\sdk\storage\Azure.Storage.Blobs\src\BlobErrors.cs
Covered lines:7
Uncovered lines:3
Coverable lines:10
Total lines:45
Line coverage:70% (7 of 10)
Covered branches:7
Total branches:8
Branch coverage:87.5% (7 of 8)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
BlobConditionsMustBeDefault(...)-100%100%
BlobOrContainerMissing(...)-0%100%
InvalidDateTimeUtc(...)-100%100%
VerifyHttpsCustomerProvidedKey(...)-100%100%
VerifyCpkAndEncryptionScopeNotBothSet(...)-66.67%75%
ParsingFullHttpRangeFailed(...)-0%100%

File(s)

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

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License.
 3
 4using System;
 5using System.Globalization;
 6using Azure.Storage.Blobs.Models;
 7
 8namespace Azure.Storage.Blobs
 9{
 10    /// <summary>
 11    /// Create exceptions for common error cases.
 12    /// </summary>
 13    internal class BlobErrors : Errors
 14    {
 15        public static ArgumentOutOfRangeException BlobConditionsMustBeDefault(params string[] conditions) =>
 816            new ArgumentOutOfRangeException($"The {string.Join(" and ", conditions)} conditions must have their default 
 17
 18        public static InvalidOperationException BlobOrContainerMissing(string leaseClient,
 19            string blobBaseClient,
 20            string blobContainerClient) =>
 021            new InvalidOperationException($"{leaseClient} requires either a {blobBaseClient} or {blobContainerClient}");
 22
 23        public static ArgumentException InvalidDateTimeUtc(string dateTime) =>
 424            new ArgumentException($"{dateTime} must be UTC");
 25
 26        internal static void VerifyHttpsCustomerProvidedKey(Uri uri, CustomerProvidedKey? customerProvidedKey)
 27        {
 2909028            if (customerProvidedKey.HasValue && !string.Equals(uri.Scheme, Constants.Https, StringComparison.OrdinalIgno
 29            {
 2830                throw new ArgumentException("Cannot use client-provided key without HTTPS.");
 31            }
 2906232        }
 33
 34        internal static void VerifyCpkAndEncryptionScopeNotBothSet(CustomerProvidedKey? customerProvidedKey, string encr
 35        {
 2883836            if (customerProvidedKey.HasValue && encryptionScope != null)
 37            {
 038                throw new ArgumentException("CustomerProvidedKey and EncryptionScope cannot both be set");
 39            }
 2883840        }
 41
 42        public static ArgumentException ParsingFullHttpRangeFailed(string range)
 043            => new ArgumentException("Could not obtain the total length from HTTP range " + range);
 44    }
 45}