Exemplo n.º 1
0
        private void CheckGetValue(MyTestObject o)
        {
            Assert.AreEqual(_propertyReflector.GetValue(o, "Id"), o.Id);
            Assert.AreEqual(_propertyReflector.GetValue(o, "Name"), o.Name);
            Assert.AreEqual(_propertyReflector.GetValue(o, "Child.Id"), o.Child.Id);
            Assert.AreEqual(_propertyReflector.GetValue(o, "Child.Name"), o.Child.Name);

            Assert.IsNull(_propertyReflector.GetValue(o, "Child.Child"));
            Assert.IsNull(_propertyReflector.GetValue(o, "Child.Child.Child.Id"));
        }
Exemplo n.º 2
0
        //[Test]
        //public void TestDynamicProxy()
        //{
        //    MyTestObject o = GetProxyTestObject();
        //    CheckGetValue(o);
        //    CheckSetValue(o);
        //}

        private void CheckSetValue(MyTestObject o)
        {
            _propertyReflector.SetValue(o, "Id", "1b");
            _propertyReflector.SetValue(o, "Name", "OneB");
            _propertyReflector.SetValue(o, "Child.Id", "2b");
            _propertyReflector.SetValue(o, "Child.Name", "TwoB");
            Assert.AreEqual(o.Id, "1b");
            Assert.AreEqual(o.Name, "OneB");
            Assert.AreEqual(o.Child.Id, "2b");
            Assert.AreEqual(o.Child.Name, "TwoB");
        }