public void HandleExceptionWithNullExceptionThrows()
 {
     ExceptionPolicyData policyData = PolicyData;
     Dictionary<Type, ExceptionPolicyEntry> entries = GetEntries(policyData);
     ExceptionPolicyDefinition policyIml = new ExceptionPolicyDefinition(policyData.Name, entries);
     policyIml.HandleException(null);
 }
 public void HandlerInChainThrowsExceptionWhenProduceError()
 {
     ExceptionPolicyData policyData = PolicyData;
     Dictionary<Type, ExceptionPolicyEntry> entries = GetEntries(policyData);
     ExceptionPolicyDefinition policyIml = new ExceptionPolicyDefinition(policyData.Name, entries);
     policyIml.HandleException(new ArgumentException());
 }
예제 #3
0
        public void HandleExceptionWithNullExceptionThrows()
        {
            ExceptionPolicyData policyData = PolicyData;
            Dictionary <Type, ExceptionPolicyEntry> entries = GetEntries(policyData);
            ExceptionPolicyDefinition policyIml             = new ExceptionPolicyDefinition(policyData.Name, entries);

            policyIml.HandleException(null);
        }
예제 #4
0
        public void HandlerInChainThrowsExceptionWhenProduceError()
        {
            ExceptionPolicyData policyData = PolicyData;
            Dictionary <Type, ExceptionPolicyEntry> entries = GetEntries(policyData);
            ExceptionPolicyDefinition policyIml             = new ExceptionPolicyDefinition(policyData.Name, entries);

            policyIml.HandleException(new ArgumentException());
        }
 public void HandleExceptionThatHasNoEntryReturnsTrue()
 {
     ExceptionPolicyData policyData = PolicyData;
     Dictionary<Type, ExceptionPolicyEntry> entries = GetEntries(policyData);
     ExceptionPolicyDefinition policyIml = new ExceptionPolicyDefinition(policyData.Name, entries);
     bool handled = policyIml.HandleException(new InvalidCastException());
     Assert.IsTrue(handled);
 }
예제 #6
0
        public void HandleExceptionThatHasNoEntryReturnsTrue()
        {
            ExceptionPolicyData policyData = PolicyData;
            Dictionary <Type, ExceptionPolicyEntry> entries = GetEntries(policyData);
            ExceptionPolicyDefinition policyIml             = new ExceptionPolicyDefinition(policyData.Name, entries);
            bool handled = policyIml.HandleException(new InvalidCastException());

            Assert.IsTrue(handled);
        }
예제 #7
0
        public void WhenRegisteredAgainstExceptionType_OnlyCorrectHandlerIsCalled()
        {
            ExceptionPolicyDefinition policyImpl = new ExceptionPolicyDefinition("APolicyName",
                                                                                 new List <ExceptionPolicyEntry>()
            {
                entry1, entry2
            });

            policyImpl.HandleException(new ArgumentNullException("TestException"));
            Assert.AreEqual(1, handler1.instanceHandledExceptionCount);
            Assert.AreEqual(0, handler2.instanceHandledExceptionCount);
        }
        public void WhenRegisteredAgainstExceptionType_OnlyCorrectHandlerIsCalled()
        {

            ExceptionPolicyDefinition policyImpl = new ExceptionPolicyDefinition("APolicyName",
                                                                     new List<ExceptionPolicyEntry>() {entry1, entry2});

            policyImpl.HandleException(new ArgumentNullException("TestException"));
            Assert.AreEqual(1, handler1.instanceHandledExceptionCount);
            Assert.AreEqual(0, handler2.instanceHandledExceptionCount);
        }