示例#1
0
        public void AllEventsAreCalled() {
            var events = new ITestEvents[] { new FooSink(), new BarSink() };

            events.Invoke(x => x.Hello("world"), NullLogger.Instance);

            Assert.That(events.OfType<FooSink>().Single().Name, Is.EqualTo("world"));
            Assert.That(events.OfType<BarSink>().Single().Name, Is.EqualTo("world"));
        }
示例#2
0
        public void AllEventsAreCalled() {
            var events = new ITestEvents[] { new FooSink(), new BarSink() };

            events.Invoke(x => x.Hello("world"), NullLogger.Instance);

            Assert.That(events.OfType<FooSink>().Single().Name, Is.EqualTo("world"));
            Assert.That(events.OfType<BarSink>().Single().Name, Is.EqualTo("world"));
        }
示例#3
0
        public void AnExceptionShouldBeLoggedAndOtherEventsWillBeFired() {
            var events = new ITestEvents[] { new FooSink(), new CrashSink(), new BarSink() };

            var logger = new TestLogger();

            events.Invoke(x => x.Hello("world"), logger);

            Assert.That(events.OfType<FooSink>().Single().Name, Is.EqualTo("world"));
            Assert.That(events.OfType<BarSink>().Single().Name, Is.EqualTo("world"));
            Assert.That(logger.LogException, Is.TypeOf<ApplicationException>());
            Assert.That(logger.LogException, Has.Property("Message").EqualTo("Illegal name 'world'"));
        }
示例#4
0
        public void AnExceptionShouldBeLoggedAndOtherEventsWillBeFired() {
            var events = new ITestEvents[] { new FooSink(), new CrashSink(), new BarSink() };

            var logger = new TestLogger();

            events.Invoke(x => x.Hello("world"), logger);

            Assert.That(events.OfType<FooSink>().Single().Name, Is.EqualTo("world"));
            Assert.That(events.OfType<BarSink>().Single().Name, Is.EqualTo("world"));
            Assert.That(logger.LogException, Is.TypeOf<ApplicationException>());
            Assert.That(logger.LogException, Has.Property("Message").EqualTo("Illegal name 'world'"));
        }