public void Invoking_an_event_when_there_are_no_subscribers_results_in_an_error() { Assert.Throws <NullReferenceException>(() => MyTestEvent.Invoke()); //You can Elvis operator your way to glory to help avoid exceptions. Assert.DoesNotThrow(() => MyTestEvent?.Invoke()); MyTestEvent += DummyAction; MyTestEvent.Invoke(); MyTestEvent -= DummyAction; void DummyAction() { }; }
public void TestEventReuse() { MyTestEvent.Invoke(_fixed); }
public void TestEventObservable() { MyTestEvent.Invoke(_fixed); }
public void TestEvent() { MyTestEvent.Invoke(new TestClass()); }