public override object RequestValue(string propertyName) { if (ReflectionUtilities.CanGetProperty(this, propertyName)) { var value = ReflectionUtilities.GetPropertyValue(this, propertyName); return(value); } return(null); }
public void Can_determine_if_property_can_be_read() { var obj = new A(); Assert.IsTrue(ReflectionUtilities.CanGetProperty(obj, "Foo")); Assert.IsTrue(ReflectionUtilities.CanGetProperty(obj, "Bar")); Assert.IsFalse(ReflectionUtilities.CanGetProperty(obj, "FooBar")); Assert.IsFalse(ReflectionUtilities.CanGetProperty(obj, "FooBarX")); }
public void CanGetProperty_throws_on_null() { Assert.AreEqual("", ReflectionUtilities.CanGetProperty(null, "Bar")); }