コード例 #1
0
        public void Emitting_Should_invoke_handler_of_failing_observer_When_using_catchAny_and_a_more_specific_exception_is_thrown()
        {
            var failingCatchWasInvoked        = false;
            var failingExHandlerWasInvoked    = false;
            var nonFailingCatchWasInvoked     = false;
            var nonFailingExHandlerWasInvoked = false;

            UnitUnderTest.CatchAny(ex => failingCatchWasInvoked = true).Subscribe(
                ev => throw new NotSupportedException("I FAILED!"),
                ex => failingExHandlerWasInvoked = true);

            UnitUnderTest.CatchAny(ex => nonFailingCatchWasInvoked = true).Subscribe(
                ev => { },
                ex => nonFailingExHandlerWasInvoked = true);

            UnitUnderTest.Emit(Mock.Of <Data>());

            failingCatchWasInvoked.Should().BeTrue();
            failingExHandlerWasInvoked.Should().BeFalse();
            nonFailingCatchWasInvoked.Should().BeFalse();
            nonFailingExHandlerWasInvoked.Should().BeFalse();
        }