< Summary

Class:Microsoft.Azure.Batch.Common.RetryDecision
Assembly:Microsoft.Azure.Batch
File(s):C:\Git\azure-sdk-for-net\sdk\batch\Microsoft.Azure.Batch\src\Common\RetryDecision.cs
Covered lines:12
Uncovered lines:0
Coverable lines:12
Total lines:52
Line coverage:100% (12 of 12)
Covered branches:0
Total branches:0

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.cctor()-100%100%
RetryWithDelay(...)-100%100%
get_RetryDelay()-100%100%
get_ShouldRetry()-100%100%
.ctor()-100%100%
.ctor(...)-100%100%

File(s)

C:\Git\azure-sdk-for-net\sdk\batch\Microsoft.Azure.Batch\src\Common\RetryDecision.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 license information.
 3
 4namespace Microsoft.Azure.Batch.Common
 5{
 6    using System;
 7
 8    /// <summary>
 9    /// Represents a decision made by an <see cref="IRetryPolicy"/>.
 10    /// </summary>
 11    public sealed class RetryDecision
 12    {
 13        /// <summary>
 14        /// A retry decision with <see cref="ShouldRetry"/> set to false
 15        /// </summary>
 116        public static readonly RetryDecision NoRetry = new RetryDecision();
 17
 18        /// <summary>
 19        /// Create a new <see cref="RetryDecision"/> with the specified delay before the next retry.
 20        /// </summary>
 21        /// <param name="retryDelay">The duration to wait before performing the retry.</param>
 22        /// <returns>A <see cref="RetryDecision"/> object with the specified retry delay and <see cref="ShouldRetry"/> s
 23        public static RetryDecision RetryWithDelay(TimeSpan retryDelay)
 24        {
 4525            return new RetryDecision(retryDelay);
 26        }
 27
 28        /// <summary>
 29        /// Gets the delay before the next retry.
 30        /// </summary>
 11531        public TimeSpan? RetryDelay { get; private set; }
 32
 33        /// <summary>
 34        /// Gets whether a retry should be performed or not.
 35        /// </summary>
 12136        public bool ShouldRetry { get; private set; }
 37
 38
 139        private RetryDecision()
 40        {
 141            this.ShouldRetry = false;
 142            this.RetryDelay = null;
 143        }
 44
 4545        private RetryDecision(TimeSpan retryDelay)
 46        {
 4547            this.ShouldRetry = true;
 4548            this.RetryDelay = retryDelay;
 4549        }
 50
 51    }
 52}