public void when_non_matching_exception_is_thrown_should_handled_should_not_be_invoked() { var cut = new TestInterceptExceptionBehavior <ArgumentException> { InsideBehavior = new ThrowingBehavior <WebException>() }; cut.SetShouldHandle(false); typeof(WebException).ShouldBeThrownBy(cut.Invoke); cut.HandledException.ShouldBeNull(); }
public void when_exception_should_not_be_handled_the_handle_method_should_not_be_invoked() { var cut = new TestInterceptExceptionBehavior <ArgumentException> { InsideBehavior = new ThrowingBehavior <ArgumentException>() }; cut.SetShouldHandle(false); Exception <ArgumentException> .ShouldBeThrownBy(cut.Invoke); cut.HandledException.ShouldBeNull(); }