Пример #1
0
        public void PropertySetterCustomization()
        {
            Thing thing = new Thing();
            PropertyDescriptor property = Thing.GetField1Property();

            Assert.IsNull(thing.Field1);
            IPropertyCustomization customization = (IPropertyCustomization)property;
            FakePropertyImpl       impl          = new FakePropertyImpl();

            impl.BaseImpl = customization.OverrideImpl(impl);
            property.SetValue(thing, "test");
            Assert.AreEqual(">>test", thing.Field1);
        }
Пример #2
0
        public void PropertyGetterCustomization()
        {
            Thing thing = new Thing();
            PropertyDescriptor property  = Thing.GetField1Property();
            const string       testValue = "test";

            thing.Field1 = testValue;
            Assert.AreEqual(testValue, thing.Field1);
            IPropertyCustomization customization = (IPropertyCustomization)property;
            FakePropertyImpl       impl          = new FakePropertyImpl();

            impl.BaseImpl = customization.OverrideImpl(impl);
            Assert.IsNotNull(impl.BaseImpl);
            Assert.AreEqual("<<" + testValue, property.GetValue(thing));
        }