Beispiel #1
0
 public void TestTypesProvidedInConstructor()
 {
     this.classifier = new BinaryExceptionClassifier(new List <Type> {
         typeof(InvalidOperationException)
     });
     Assert.IsTrue(this.classifier.Classify(new InvalidOperationException("Foo")));
 }
Beispiel #2
0
 public void TestTypesProvidedInConstructorWithNonDefault()
 {
     this.classifier = new BinaryExceptionClassifier(new List <Type> {
         typeof(InvalidOperationException)
     }, false);
     Assert.IsFalse(this.classifier.Classify(new InvalidOperationException("Foo")));
 }
Beispiel #3
0
 public PollyRetryTemplate(Dictionary <Type, bool> retryableExceptions, int maxAttempts, bool defaultRetryable, int backOffInitialInterval, int backOffMaxInterval, double backOffMultiplier)
 {
     _retryableExceptions    = new BinaryExceptionClassifier(retryableExceptions, defaultRetryable);
     _maxAttempts            = maxAttempts;
     _backOffInitialInterval = backOffInitialInterval;
     _backOffMaxInterval     = backOffMaxInterval;
     _backOffMultiplier      = backOffMultiplier;
 }
 /// <summary>Initializes a new instance of the <see cref="SimpleRetryPolicy"/> class.</summary>
 /// <param name="maxAttempts">The max attempts.</param>
 /// <param name="retryableExceptions">The retryable exceptions.</param>
 public SimpleRetryPolicy(int maxAttempts, IDictionary<Type, bool> retryableExceptions)
 {
     this.maxAttempts = maxAttempts;
     this.retryableClassifier = new BinaryExceptionClassifier(retryableExceptions);
 }
Beispiel #5
0
 public void SetUp()
 {
     this.classifier = new BinaryExceptionClassifier(false);
 }
Beispiel #6
0
 public void TestDefaultProvided()
 {
     this.classifier = new BinaryExceptionClassifier(true);
     Assert.IsTrue(this.classifier.GetDefault());
 }
 public void TestTypesProvidedInConstructorWithNonDefault()
 {
     this.classifier = new BinaryExceptionClassifier(new List<Type> { typeof(InvalidOperationException) }, false);
     Assert.IsFalse(this.classifier.Classify(new InvalidOperationException("Foo")));
 }
 public void TestTypesProvidedInConstructor()
 {
     this.classifier = new BinaryExceptionClassifier(new List<Type> { typeof(InvalidOperationException) });
     Assert.IsTrue(this.classifier.Classify(new InvalidOperationException("Foo")));
 }
 public void TestDefaultProvided()
 {
     this.classifier = new BinaryExceptionClassifier(true);
     Assert.IsTrue(this.classifier.GetDefault());
 }
 public void SetUp()
 {
     this.classifier = new BinaryExceptionClassifier(false);
 }
Beispiel #11
0
 /// <summary>Initializes a new instance of the <see cref="SimpleRetryPolicy"/> class.</summary>
 /// <param name="maxAttempts">The max attempts.</param>
 /// <param name="retryableExceptions">The retryable exceptions.</param>
 public SimpleRetryPolicy(int maxAttempts, IDictionary <Type, bool> retryableExceptions)
 {
     this.maxAttempts         = maxAttempts;
     this.retryableClassifier = new BinaryExceptionClassifier(retryableExceptions);
 }