public void HasValueWorks() { var component = Mock.Of <IDependencyComponent>(); var prop = Mock.Of <IDependencyProperty>(); var store = new LocalValueStore(component, 0); Assert.False(store.HasValue(prop)); store.SetValue(prop, "value"); Assert.True(store.HasValue(prop)); store.SetValue(prop, "other value"); Assert.True(store.HasValue(prop)); store.ClearValue(prop); Assert.False(store.HasValue(prop)); store.SetValue(prop, "reassign value"); Assert.True(store.HasValue(prop)); }
public void CanClearValue() { var component = Mock.Of <IDependencyComponent>(); var prop = Mock.Of <IDependencyProperty>(); var store = new LocalValueStore(component, 0); store.SetValue(prop, "value"); var raised = 0; store.ValueChanged += (s, e) => { Assert.Same(component, e.Component); Assert.Equal(Maybe.FromValue <object>("value"), e.OldValue); Assert.Equal(Maybe.None <object>(), e.NewValue); raised++; }; store.ClearValue(prop); Assert.Equal(1, raised); Assert.False(store.HasValue(prop)); }