public void SetProperty_should_add_value_to_store() { object instance = new object(); var store = AttachedPropertyStore.FromValue(instance); store.SetProperty(Prop, instance); Assert.True(store.TryGetProperty(Prop, out _)); }
public void FromValue_should_create_reusable_store() { object instance = new object(); var store1 = AttachedPropertyStore.FromValue(instance); var store2 = AttachedPropertyStore.FromValue(instance); Assert.Same(store1, store2); }
public void TryGetProperty_should_retrieve_value() { object instance = new object(); var store = AttachedPropertyStore.FromValue(instance); store.SetProperty(Prop, instance); store.TryGetProperty(Prop, out var result); Assert.Same(instance, result); }
public void GetEnumerator_should_contain_contents() { object instance = new object(); var store = AttachedPropertyStore.FromValue(instance); store.SetProperty(Prop, instance); Assert.Equal(new [] { KeyValuePair.Create(Prop, instance), }, store.ToArray()); }
public void FromValue_should_throw_on_missing_argument() { Assert.Throws <ArgumentNullException>( () => AttachedPropertyStore.FromValue(null) ); }