< Summary

Class:Azure.Iot.Hub.Service.IfMatchPreconditionExtensions
Assembly:Azure.Iot.Hub.Service
File(s):C:\Git\azure-sdk-for-net\sdk\iot\Azure.Iot.Hub.Service\src\IfMatchPreconditionExtensions.cs
Covered lines:5
Uncovered lines:1
Coverable lines:6
Total lines:29
Line coverage:83.3% (5 of 6)
Covered branches:3
Total branches:4
Branch coverage:75% (3 of 4)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
GetIfMatchHeaderValue(...)-83.33%75%

File(s)

C:\Git\azure-sdk-for-net\sdk\iot\Azure.Iot.Hub.Service\src\IfMatchPreconditionExtensions.cs

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License.
 3
 4using System;
 5
 6namespace Azure.Iot.Hub.Service
 7{
 8    /// <summary>
 9    /// Helper functions for using the <see cref="IfMatchPrecondition"/> enum.
 10    /// </summary>
 11    internal static class IfMatchPreconditionExtensions
 12    {
 13        /// <summary>
 14        /// Get the ifMatch header value for an HTTP request that targets a particular service resource.
 15        /// </summary>
 16        /// <param name="precondition">The user supplied if match precondition.</param>
 17        /// <param name="ETag">The ETag of the resource that the HTTP request is targeting.</param>
 18        /// <returns>The ifMatch header value.</returns>
 19        internal static string GetIfMatchHeaderValue(IfMatchPrecondition precondition, string ETag)
 20        {
 22821            return precondition switch
 22822            {
 38023                IfMatchPrecondition.IfMatch => $"\"{ETag}\"",
 30424                IfMatchPrecondition.UnconditionalIfMatch => "*",
 025                _ => null,
 22826            };
 27        }
 28    }
 29}

Methods/Properties

GetIfMatchHeaderValue(...)