Ejemplo n.º 1
0
        public void Accessor_Protected_Object_InheritedVirtualMethod_OnAbstract()
        {
            AbstractionForAccessorTest instance = new AccessorTestObject();
            var objAcc = new ObjectAccessor(instance);

            var actualValue = (string)objAcc.Invoke("ProtectedInheritedVirtualMethod", '*', 5);

            Assert.AreEqual("ProtectedInheritedVirtualMethod***** abstract value", actualValue);

            actualValue = (string)objAcc.Invoke("ProtectedInheritedVirtualMethod",
                                                new[] { typeof(char), typeof(int) },
                                                new object[] { '*', 3 });

            Assert.AreEqual("ProtectedInheritedVirtualMethod*** abstract value", actualValue);
        }
Ejemplo n.º 2
0
        public void Accessor_Protected_Object_InheritedProperty_OnAbstract()
        {
            AbstractionForAccessorTest instance = new AccessorTestObject();
            var objAcc = new ObjectAccessor(instance);

            var origValue = (int)objAcc.GetProperty("ProtectedInheritedProperty");

            objAcc.SetProperty("ProtectedInheritedProperty", origValue + 1);
            var actualValue = (int)objAcc.GetProperty("ProtectedInheritedProperty");

            Assert.AreEqual(origValue + 1, actualValue);

            objAcc.SetFieldOrProperty("ProtectedInheritedProperty", origValue - 1);
            actualValue = (int)objAcc.GetFieldOrProperty("ProtectedInheritedProperty");
            Assert.AreEqual(origValue - 1, actualValue);
        }