コード例 #1
0
 public void TestPrivatePropertyGet()
 {
     var reflector = new TypeReflector(typeof(TestClass));
     var property = reflector.GetProperty("BirthDate");
     var val = PropertyCache.GetInvoker<TestClass, DateTime>(_instance, property);
     var result = val.GetValue();
     Assert.AreEqual(result, DateTime.MinValue);
 }
コード例 #2
0
 public void TestPrivatePropertySet()
 {
     var reflector = new TypeReflector(typeof(TestClass));
     var property = reflector.GetProperty("SocialNumber");
     var val = PropertyCache.GetInvoker<TestClass, string>(_instance, property);
     val.SetValue("123456789");
     var result = val.GetValue();
     Assert.AreEqual(result, "123456789");
 }