< Summary

Class:Microsoft.Rest.Azure.CloudExceptionExtensions
Assembly:Microsoft.Azure.Search.Common
File(s):C:\Git\azure-sdk-for-net\sdk\search\Microsoft.Azure.Search.Common\src\Customizations\Rest\CloudExceptionExtensions.cs
Covered lines:1
Uncovered lines:0
Coverable lines:1
Total lines:22
Line coverage:100% (1 of 1)
Covered branches:2
Total branches:4
Branch coverage:50% (2 of 4)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
IsAccessConditionFailed(...)-100%50%

File(s)

C:\Git\azure-sdk-for-net\sdk\search\Microsoft.Azure.Search.Common\src\Customizations\Rest\CloudExceptionExtensions.cs

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License. See License.txt in the project root for
 3// license information.
 4
 5namespace Microsoft.Rest.Azure
 6{
 7    using System.Net;
 8
 9    /// <summary>
 10    /// Defines extension methods for the CloudException class.
 11    /// </summary>
 12    public static class CloudExceptionExtensions
 13    {
 14        /// <summary>
 15        /// Indicates whether the exception is the result of a failed access condition (ETag) check.
 16        /// </summary>
 17        /// <param name="exception">The exception to check.</param>
 18        /// <returns>true if the exception is a failed access condition (HTTP 412 Precondition Failed), false otherwise.
 19        public static bool IsAccessConditionFailed(this CloudException exception) =>
 4020            exception?.Response?.StatusCode == HttpStatusCode.PreconditionFailed;
 21    }
 22}

Methods/Properties

IsAccessConditionFailed(...)