< Summary

Class:Microsoft.Azure.ServiceBus.MessagingUtilities
Assembly:Microsoft.Azure.ServiceBus
File(s):C:\Git\azure-sdk-for-net\sdk\servicebus\Microsoft.Azure.ServiceBus\src\MessagingUtilities.cs
Covered lines:0
Uncovered lines:8
Coverable lines:8
Total lines:31
Line coverage:0% (0 of 8)
Covered branches:0
Total branches:4
Branch coverage:0% (0 of 4)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
CalculateRenewAfterDuration(...)-0%0%
ShouldRetry(...)-0%0%

File(s)

C:\Git\azure-sdk-for-net\sdk\servicebus\Microsoft.Azure.ServiceBus\src\MessagingUtilities.cs

#LineLine coverage
 1// Copyright (c) Microsoft. All rights reserved.
 2// Licensed under the MIT license. See LICENSE file in the project root for full license information.
 3
 4namespace Microsoft.Azure.ServiceBus
 5{
 6    using System;
 7
 8    static class MessagingUtilities
 9    {
 10        public static TimeSpan CalculateRenewAfterDuration(DateTime lockedUntilUtc)
 11        {
 012            var remainingTime = lockedUntilUtc - DateTime.UtcNow;
 13
 014            if(remainingTime < TimeSpan.FromMilliseconds(400))
 15            {
 016                return TimeSpan.Zero;
 17            }
 18
 019            var buffer = TimeSpan.FromTicks(Math.Min(remainingTime.Ticks / 2, Constants.MaximumRenewBufferDuration.Ticks
 020            var renewAfter = remainingTime - buffer;
 21
 022            return renewAfter;
 23        }
 24
 25        public static bool ShouldRetry(Exception exception)
 26        {
 027            var serviceBusException = exception as ServiceBusException;
 028            return serviceBusException?.IsTransient == true;
 29        }
 30    }
 31}