public void ShouldReturnDefaultIfNoneStored() { var foo = new Foo(); var value = NotifiableProperty.Get(foo, x => x.Age); Assert.AreEqual(0, value); }
public void ShouldStoreValueForProperty() { var foo = new Foo(); NotifiableProperty.Set(foo, x => x.Name, "new name"); var value = NotifiableProperty.Get(foo, x => x.Name); Assert.AreEqual("new name", value); }
public void ShouldDistinguishDifferentTargets() { var foo1 = new Foo(); var foo2 = new Foo(); NotifiableProperty.Set(foo1, x => x.Name, "new name"); NotifiableProperty.Set(foo2, x => x.Name, "old name"); var value1 = NotifiableProperty.Get(foo1, x => x.Name); var value2 = NotifiableProperty.Get(foo2, x => x.Name); Assert.AreEqual("new name", value1); Assert.AreEqual("old name", value2); }