WHEN_no_listener_THEN_it_should_not_fail() { var bus = new Sample3(); Check .ThatCode(() => bus.SaySomething("hello")) .DoesNotThrow(); }
WHEN_listener_THEN_it_should_get_the_message() { var bus = new Sample3(); string message = null; bus.onNewMessage += m => message = m; Check .ThatCode(() => bus.SaySomething("hello")) .DoesNotThrow(); Check.That( message) .IsNotNull() .And.IsEqualTo("hello"); }