Example #1
0
        public void GivenAppExceptionRuleWhenDerivedFromDerivativeExceptionProvidedThenShouldAdviceToHandle()
        {
            // Arrange
            var sut       = new ExceptionRuleForErrorProvider <ApplicationExceptionBase>();
            var exception = new OurDerivedApplicationException("Error");

            // Act
            var result = sut.CanHandle(exception);

            // Assert
            Assert.True(result);
        }
Example #2
0
        public void GivenAppExceptionRuleWhenUnknownExceptionProvidedThenShouldAdviceToSkip()
        {
            // Arrange
            var sut       = new ExceptionRuleForErrorProvider <ApplicationExceptionBase>();
            var exception = new ThirdPartyFailureException("Error");

            // Act
            var result = sut.CanHandle(exception);

            // Assert
            Assert.False(result);
        }
Example #3
0
        public void GivenAppExceptionRuleWhenDerivedExceptionProvidedAndPredicateMatchesThenShouldAdviceToHandle()
        {
            // Arrange
            var sut       = new ExceptionRuleForErrorProvider <ApplicationExceptionBase>(f => f.Message.Contains("rr"));
            var exception = new OurApplicationException("Error");

            // Act
            var result = sut.CanHandle(exception);

            // Assert
            Assert.True(result);
        }