Example #1
0
        public void Accessor_Protected_Type_Property_OnImplementation()
        {
            var typeAcc = new TypeAccessor(typeof(AccessorTestObject));

            var origValue = (int)typeAcc.GetStaticProperty("ProtectedStaticProperty");

            typeAcc.SetStaticProperty("ProtectedStaticProperty", origValue + 1);
            var actualValue = (int)typeAcc.GetStaticProperty("ProtectedStaticProperty");

            Assert.AreEqual(origValue + 1, actualValue);

            typeAcc.SetStaticFieldOrProperty("ProtectedStaticProperty", origValue - 1);
            actualValue = (int)typeAcc.GetStaticFieldOrProperty("ProtectedStaticProperty");
            Assert.AreEqual(origValue - 1, actualValue);
        }
Example #2
0
        public void Accessor_Private_Type_Property()
        {
            var typeAcc = new TypeAccessor(typeof(AccessorTestObject));

            var origValue = (int)typeAcc.GetStaticProperty("StaticPrivateProperty");

            typeAcc.SetStaticProperty("StaticPrivateProperty", origValue + 1);
            var actualValue = (int)typeAcc.GetStaticProperty("StaticPrivateProperty");

            Assert.AreEqual(origValue + 1, actualValue);

            typeAcc.SetStaticFieldOrProperty("StaticPrivateProperty", origValue - 1);
            actualValue = (int)typeAcc.GetStaticFieldOrProperty("StaticPrivateProperty");
            Assert.AreEqual(origValue - 1, actualValue);
        }