public void Retry() { ArgumentException exception = new ArgumentException("TestException"); RetryExtension extension = new RetryExtension("Scheduler", 1000, 2, typeof(Exception)); extension.ModuleController = m_moduleController; extension.ModuleCoordinator = m_moduleCoordinator; extension.RetryExceptionTypes.Add(typeof(ArgumentException)); extension.Attach(); Expect.Exactly(2).On(m_moduleCoordinator).Method("PostMessage").With( new EqualMatcher("Scheduler"), new ScheduledMessageMatcher("TestModule", "TestMessage")); bool exceptionHandled; m_moduleController.RaiseConsumeMessageExceptionOccurred("TestModule", "TestMessage", exception, out exceptionHandled); Assert.IsTrue(exceptionHandled); m_moduleController.RaiseConsumeMessageExceptionOccurred("TestModule", "TestMessage", exception, out exceptionHandled); Assert.IsTrue(exceptionHandled); m_moduleController.RaiseConsumeMessageExceptionOccurred("TestModule", "TestMessage", exception, out exceptionHandled); Assert.IsFalse(exceptionHandled); extension.Detach(); m_mockery.VerifyAllExpectationsHaveBeenMet(); }
public void NotSupportedException() { ArgumentException exception = new ArgumentException("TestException"); RetryExtension extension = new RetryExtension("Scheduler", 1000, 2, typeof(NotImplementedException)); extension.ModuleController = m_moduleController; extension.ModuleCoordinator = m_moduleCoordinator; extension.Attach(); Expect.Never.On(m_moduleCoordinator).Method("PostMessage"); bool exceptionHandled; m_moduleController.RaiseConsumeMessageExceptionOccurred("TestModule", "TestMessage", exception, out exceptionHandled); Assert.IsFalse(exceptionHandled); extension.Detach(); m_mockery.VerifyAllExpectationsHaveBeenMet(); }