public void ShouldClassifyASpecifiedExceptionWithTheGivenValueEvenIfParentValueIsDifferent()
        {
            var specifiedExceptions = new Dictionary <Type, bool>();

            specifiedExceptions.Add(typeof(TestParentException), true);
            specifiedExceptions.Add(typeof(TestGrandChildException), false);
            SubclassExceptionClassifier classifier = new SubclassExceptionClassifier(specifiedExceptions, false);

            Assert.True(classifier.Classify(new TestParentException()));
            Assert.False(classifier.Classify(new TestGrandChildException()));
        }
        public void ShouldClassifyEverySpecifiedExceptionAndTheirChildrenAsTheGivenValue()
        {
            var specifiedExceptions = new Dictionary <Type, bool>();

            specifiedExceptions.Add(typeof(TestParentException), true);
            specifiedExceptions.Add(typeof(TestOtherException), false);
            SubclassExceptionClassifier classifier = new SubclassExceptionClassifier(specifiedExceptions, false);

            Assert.True(classifier.Classify(new TestParentException()));
            Assert.True(classifier.Classify(new TestChildException()));
            Assert.True(classifier.Classify(new TestGrandChildException()));
            Assert.False(classifier.Classify(new TestOtherException()));
        }
        public void ShouldByDefaultClassifyEveryUnspecifiedExceptionAsFalse()
        {
            SubclassExceptionClassifier classifier = new SubclassExceptionClassifier();

            Assert.False(classifier.Classify(new TestOtherException()));
        }
        public void ShouldClassifyEveryUnspecifiedExceptionWithTheGivenDefaultValue()
        {
            SubclassExceptionClassifier classifier = new SubclassExceptionClassifier(true);

            Assert.True(classifier.Classify(new TestOtherException()));
        }
 public bool CanRetry(Exception exception)
 {
     return((exception == null || retryableClassifier.Classify(exception)) && CanRetry());
 }