public void NotificationTest() { var observable = new Observable(); const int type = 1; _lastNotification = null; observable.NotifyObservers(type, EventArgs.Empty); Assert.IsNull(_lastNotification); observable.AddObserver(this); observable.NotifyObservers(type, EventArgs.Empty); Assert.IsNotNull(_lastNotification); // ReSharper disable once PossibleNullReferenceException Assert.AreEqual(type, _lastNotification.Type); Assert.AreSame(observable, _lastNotification.Sender); Assert.AreEqual(EventArgs.Empty, _lastNotification.EventArgs); }
public void OnObservableNotification(ObservableNotification notification) { _lastNotification = new ObservableNotification(notification.Sender, notification.Type, notification.EventArgs); }