public void ShouldClearValue() { BusinessObject component = new BusinessObject() { Name = "TestName" }; PropertyItem property = new PropertyItem(new PropertyGrid(), component, BusinessObject.ExtractProperty("Name")); Assert.AreEqual<string>("TestName", property.GetValue().ToString()); property.ClearValue(); Assert.AreEqual<string>("DefaultName", property.GetValue().ToString()); }
public void ShouldClearValue() { BusinessObject component = new BusinessObject() { Name = "TestName" }; PropertyItem property = new PropertyItem(new PropertyGrid(), component, BusinessObject.ExtractProperty("Name")); Assert.AreEqual <string>("TestName", property.GetValue().ToString()); property.ClearValue(); Assert.AreEqual <string>("DefaultName", property.GetValue().ToString()); }
public void ShouldNotifyOnValueCleared() { BusinessObject component = new BusinessObject() { Name = "TestName" }; PropertyItem property = new PropertyItem(new PropertyGrid(), component, BusinessObject.ExtractProperty("Name")); bool cleared = false; property.PropertyChanged += (sender, e) => { if (e.PropertyName == "PropertyValue") { cleared = true; } }; property.ClearValue(); Assert.IsTrue(cleared); }
public void ShouldNotifyOnValueCleared() { BusinessObject component = new BusinessObject() { Name = "TestName" }; PropertyItem property = new PropertyItem(new PropertyGrid(), component, BusinessObject.ExtractProperty("Name")); bool cleared = false; property.PropertyChanged += (sender, e) => { if (e.PropertyName == "PropertyValue") cleared = true; }; property.ClearValue(); Assert.IsTrue(cleared); }