public void when_matching_exception_is_thrown_by_inside_behavior_it_should_be_handled() { var cut = new TestInterceptExceptionBehavior <ArgumentException> { InsideBehavior = new ThrowingBehavior <ArgumentException>() }; cut.Invoke(); cut.HandledException.ShouldBeOfType <ArgumentException>(); }
public void when_no_exception_is_thrown_none_should_be_handled() { var insideBehavior = new DoNothingBehavior(); var cut = new TestInterceptExceptionBehavior <ArgumentException> { InsideBehavior = insideBehavior }; cut.Invoke(); cut.HandledException.ShouldBeNull(); }
public void should_invoke_inside_behavior() { var insideBehavior = new DoNothingBehavior(); var cut = new TestInterceptExceptionBehavior <ArgumentException> { InsideBehavior = insideBehavior }; cut.Invoke(); insideBehavior.Invoked.ShouldBeTrue(); }
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(); }
public void invoke_should_throw_an_exception_when_no_inside_behavior_is_set() { var interceptExceptionBehavior = new TestInterceptExceptionBehavior <ArgumentException>(); typeof(FubuAssertionException).ShouldBeThrownBy(interceptExceptionBehavior.Invoke); }
public void invoke_should_throw_an_exception_when_no_inside_behavior_is_set() { var interceptExceptionBehavior = new TestInterceptExceptionBehavior <ArgumentException>(); Exception <FubuAssertionException> .ShouldBeThrownBy(() => interceptExceptionBehavior.Invoke().Wait()); }