public void UnscribeFromAllDoesNotGetNotified() { var fakeDateTimeSubscriber = A.Fake <Action <object, DateTime> >(); var fakeTimeSpanSubscriber = A.Fake <Action <object, TimeSpan> >(); _eventSystem.Subscribe(this, fakeDateTimeSubscriber); _eventSystem.Subscribe(this, fakeTimeSpanSubscriber); _eventSystem.Unsubscribe(this); var utcNow = DateTime.UtcNow; _eventSystem.Send(this, utcNow); var answerToTheUltimateQuestionOfLifeTheUniverseAndEverything = TimeSpan.FromMinutes(42); _eventSystem.Send(this, answerToTheUltimateQuestionOfLifeTheUniverseAndEverything); A.CallTo(() => fakeDateTimeSubscriber.Invoke(A <object> .Ignored, A <DateTime> .Ignored)) .MustNotHaveHappened(); A.CallTo(() => fakeTimeSpanSubscriber.Invoke(A <object> .Ignored, A <TimeSpan> .Ignored)) .MustNotHaveHappened(); }
public void Unsubscribe() { m_eventSystem.Unsubscribe <TestEvent>(EventHandler); }