Example #1
0
 public override object RequestValue(string propertyName)
 {
     if (ReflectionUtilities.CanGetProperty(this, propertyName))
     {
         var value = ReflectionUtilities.GetPropertyValue(this, propertyName);
         return(value);
     }
     return(null);
 }
Example #2
0
        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"));
        }
Example #3
0
 public void CanGetProperty_throws_on_null()
 {
     Assert.AreEqual("", ReflectionUtilities.CanGetProperty(null, "Bar"));
 }