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()); }
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()); }
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); }
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); }
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); }