< Summary

Class:Azure.Core.ConditionalRequestOptionsExtensions
Assembly:Azure.Data.AppConfiguration
File(s):C:\Git\azure-sdk-for-net\sdk\core\Azure.Core\src\Shared\ConditionalRequestOptionsExtensions.cs
Covered lines:10
Uncovered lines:4
Coverable lines:14
Total lines:40
Line coverage:71.4% (10 of 14)
Covered branches:9
Total branches:14
Branch coverage:64.2% (9 of 14)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
ApplyHeaders(...)-71.43%64.29%

File(s)

C:\Git\azure-sdk-for-net\sdk\core\Azure.Core\src\Shared\ConditionalRequestOptionsExtensions.cs

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License.
 3
 4using System.Globalization;
 5
 6namespace Azure.Core
 7{
 8    internal static class ConditionalRequestOptionsExtensions
 9    {
 10        public static void ApplyHeaders(Request request, MatchConditions options)
 11        {
 15612            if (options.IfMatch.HasValue)
 13            {
 3214                string value = options.IfMatch.Value == ETag.All ?
 3215                    options.IfMatch.Value.ToString() : $"\"{options.IfMatch.Value.ToString()}\"";
 3216                request.Headers.Add(HttpHeader.Names.IfMatch, value);
 17            }
 18
 15619            if (options.IfNoneMatch.HasValue)
 20            {
 12421                string value = options.IfNoneMatch.Value == ETag.All ?
 12422                    options.IfNoneMatch.Value.ToString() : $"\"{options.IfNoneMatch.Value.ToString()}\"";
 12423                request.Headers.Add(HttpHeader.Names.IfNoneMatch, value);
 24            }
 25
 15626            if (options is RequestConditions dateOptions)
 27            {
 028                if (dateOptions.IfModifiedSince.HasValue)
 29                {
 030                    request.Headers.Add(HttpHeader.Names.IfModifiedSince, dateOptions.IfModifiedSince.Value.UtcDateTime.
 31                }
 32
 033                if (dateOptions.IfUnmodifiedSince.HasValue)
 34                {
 035                    request.Headers.Add(HttpHeader.Names.IfUnmodifiedSince, dateOptions.IfUnmodifiedSince.Value.UtcDateT
 36                }
 37            }
 15638        }
 39    }
 40}

Methods/Properties

ApplyHeaders(...)