public void GivenSubscriptionToTwoLevelPath_WhenRootChangesButValuesAreSame_NoNotificationAreReceived() { var changeSource = new DummyViewModel { Child = new DummyViewModel { Text = "Same" } }; var sut = new ObservablePropertyChain(changeSource, "Child.Text"); var hit = false; sut.Subscribe(o => hit = true); changeSource.Child = new DummyViewModel { Text = "Same" }; Assert.IsFalse(hit); }
public void GivenSubscriptionToTwoLevelPath_WhenRootChanges_NotificationsShouldArrive() { var changeSource = new DummyViewModel { Child = new DummyViewModel { Text = "Old text" } }; var sut = new ObservablePropertyChain(changeSource, "Child.Text"); object actualText = null; sut.Subscribe(o => actualText = o); changeSource.Child = new DummyViewModel { Text = "This is the real thing" }; Assert.AreEqual("This is the real thing", actualText); }
public void SubscriptionToTwoLevelPath() { var changeSource = new DummyViewModel { Child = new DummyViewModel() }; var sut = new ObservablePropertyChain(changeSource, "Child.Text"); object actualText = null; sut.Subscribe(o => actualText = o); changeSource.Child.Text = "Hello world"; Assert.AreEqual("Hello world", actualText); }
public void SubscriptionToOneLevelPath() { var changeSource = new DummyViewModel(); var sut = new ObservablePropertyChain(changeSource, "Text"); object actualText = null; sut.Subscribe(o => actualText = o); changeSource.Text = "Hello world"; Assert.Equal("Hello world", actualText); }
public void GivenSubscriptionToTwoLevelPath_WhenRootChangesInDifferentSteps_NotificationsShouldArrive() { var changeSource = new DummyViewModel { Child = new DummyViewModel { Text = "Old text" } }; var sut = new ObservablePropertyChain(changeSource, "Child.Text"); object actualText = null; sut.Subscribe(o => actualText = o); changeSource.Child = new DummyViewModel(); changeSource.Child.Text = "This is the real thing"; Assert.Equal("This is the real thing", actualText); }
public void GivenSubscriptionToTwoLevelPath_WhenRootChangesButValuesAreSame_NoNotificationAreReceived() { var changeSource = new DummyViewModel { Child = new DummyViewModel { Text = "Same" } }; var sut = new ObservablePropertyChain(changeSource, "Child.Text"); var hit = false; sut.Subscribe(o => hit = true); changeSource.Child = new DummyViewModel { Text = "Same" }; Assert.False(hit); }