public void ObserverGetsUpdatedByIncDecAndSet() { MockOberserver observer = new Mock.MockOberserver(); try { _clock.Attach(observer); _clock.IncDec(1, 0, 0); Assert.IsTrue(ObserverUpdated(observer)); observer.UpdateOccured = false; _clock.Set(1, 2, 3); Assert.IsTrue(ObserverUpdated(observer)); } finally { _clock.Detach(observer); } }
public void OberserverGetsUpdatedByTimer() { _clock.Start(); MockOberserver observer = new Mock.MockOberserver(); _clock.Attach(observer); try { Assert.IsTrue(ObserverUpdated(observer)); observer.UpdateOccured = false; _clock.Stop(); Assert.IsFalse(ObserverUpdated(observer)); } finally { _clock.Detach(observer); _clock.Stop(); } }
public void DetachThrowsExceptionWhenDetachingUnknownObserver() { MockOberserver observer = new Mock.MockOberserver(); _clock.Detach(observer); }