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")); }
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'")); }