Esempio n. 1
0
        public void ExceptionHandling()
        {
            Publisher p = new Publisher();
            SubscriberThrowingException s = new SubscriberThrowingException();

            this.testee.Register(p);
            this.testee.Register(s);

            p.Invoking(x => x.CallSimpleEvent()).ShouldThrow <SubscriberThrowingException.TestException>();
        }
Esempio n. 2
0
        public void ExceptionHandlingMultipleException()
        {
            Publisher p = new Publisher();
            SubscriberThrowingException s1 = new SubscriberThrowingException();
            SubscriberThrowingException s2 = new SubscriberThrowingException();

            this.testee.Register(p);
            this.testee.Register(s1);
            this.testee.Register(s2);

            Assert.Throws <SubscriberThrowingException.TestException>(
                () => p.CallSimpleEvent());
        }
Esempio n. 3
0
        public void ExceptionHandlingWithExtensionHandlingException()
        {
            Publisher p = new Publisher();
            SubscriberThrowingException s = new SubscriberThrowingException();

            var exceptionHandlingExtension = new ExceptionHandlingExtension();

            this.testee.AddExtension(exceptionHandlingExtension);

            this.testee.Register(p);
            this.testee.Register(s);

            p.CallSimpleEvent();

            exceptionHandlingExtension.HandledException
            .Should().BeOfType <SubscriberThrowingException.TestException>();
        }
        public void ExceptionHandlingMultipleException()
        {
            Publisher p = new Publisher();
            SubscriberThrowingException s1 = new SubscriberThrowingException();
            SubscriberThrowingException s2 = new SubscriberThrowingException();

            this.testee.Register(p);
            this.testee.Register(s1);
            this.testee.Register(s2);

            Assert.Throws<SubscriberThrowingException.TestException>(
                () => p.CallSimpleEvent());
        }
        public void ExceptionHandlingWithExtensionHandlingException()
        {
            Publisher p = new Publisher();
            SubscriberThrowingException s = new SubscriberThrowingException();

            var exceptionHandlingExtension = new ExceptionHandlingExtension();
            this.testee.AddExtension(exceptionHandlingExtension);

            this.testee.Register(p);
            this.testee.Register(s);

            p.CallSimpleEvent();

            exceptionHandlingExtension.HandledException
                .Should().BeOfType<SubscriberThrowingException.TestException>();
        }
        public void ExceptionHandling()
        {
            Publisher p = new Publisher();
            SubscriberThrowingException s = new SubscriberThrowingException();

            this.testee.Register(p);
            this.testee.Register(s);

            p.Invoking(x => x.CallSimpleEvent()).ShouldThrow<SubscriberThrowingException.TestException>();
        }
        public void ExceptionHandling()
        {
            try
            {
                Publisher p = new Publisher();
                SubscriberThrowingException s = new SubscriberThrowingException();

                this.testee.Register(p);
                this.testee.Register(s);

                p.CallSimpleEvent();

                Assert.Fail("must not be reached.");
            }
            catch (EventTopicException e)
            {
                Assert.IsTrue(e.InnerException is SubscriberThrowingException.TestException);
            }
        }