Beispiel #1
0
        public void RethrowExceptions_will_cause_exceptions_to_be_rethrown()
        {
            var dispatcher = new TestActionDispatcher(FExceptionThrowingMethod);

            dispatcher.RethrowExceptions();

            Expect(() => dispatcher.Invoke()).ToThrow.Message.EqualTo("this throws");
        }
Beispiel #2
0
        public void After_will_be_called_after()
        {
            bool afterCalled = false;
            var  dispatcher  = new TestActionDispatcher(() => {});

            dispatcher.After(() => { afterCalled = true; });

            dispatcher.Invoke();
            Assert.True(afterCalled);
        }
Beispiel #3
0
        public void Before_will_be_called_first()
        {
            bool beforeCalled = false;
            var  dispatcher   = new TestActionDispatcher(() => {});

            dispatcher.Before(() => { beforeCalled = true; });

            dispatcher.Invoke();
            Assert.True(beforeCalled);
        }
Beispiel #4
0
        public void Invoke_will_swallow_exceptions_by_default()
        {
            var dispatcher = new TestActionDispatcher(FExceptionThrowingMethod);

            Assert.DoesNotThrow(() => dispatcher.Invoke());
        }