Example #1
0
        public void CanGetSetSimpleProperty()
        {
            if (SystemUtils.MonoRuntime)
            {
                // TODO (EE): find solution for Mono
                return;
            }
            object           o = GetVisualBasicTestObject();
            IDynamicProperty simpleProperty = Create(o.GetType().GetProperty("SimpleProperty"));

            simpleProperty.SetValue(o, "CanGetSimpleText", "args");
            Assert.AreEqual("CanGetSimpleText", ThisLastPropertyValue.GetValue(o));
            Assert.AreEqual("CanGetSimpleText", simpleProperty.GetValue(o));
        }
Example #2
0
        public void CanGetSetSimpleIndexer()
        {
            if (SystemUtils.MonoRuntime)
            {
                // TODO (EE): find solution for Mono
                return;
            }

            object           o = GetVisualBasicTestObject();
            IDynamicProperty simpleProperty = Create(o.GetType().GetProperty("SimpleIndexer"));

            // write
            simpleProperty.SetValue(o, "CanGetSetSimpleIndexer", 2);
            Assert.AreEqual("CanGetSetSimpleIndexer", ThisLastPropertyValue.GetValue(o));
            Assert.AreEqual(2, ThisArg1.GetValue(o));

            // read
            object value = simpleProperty.GetValue(o, 3);

            Assert.AreEqual("CanGetSetSimpleIndexer", value);
            Assert.AreEqual(3, ThisArg1.GetValue(o));
        }
Example #3
0
        public void CanGetSetComplexIndexer()
        {
            if (SystemUtils.MonoRuntime)
            {
                // TODO (EE): find solution for Mono
                return;
            }
            object           o        = GetVisualBasicTestObject();
            IDynamicProperty property = Create(o.GetType().GetProperty("ComplexIndexer"));

            // write
            property.SetValue(o, "CanGetSetComplexIndexer", 2, "Arg2");
            Assert.AreEqual("CanGetSetComplexIndexer", ThisLastPropertyValue.GetValue(o));
            Assert.AreEqual(2.0, (double)ThisArg1.GetValue(o));
            Assert.AreEqual("Arg2", ThisArg2.GetValue(o));

            // read
            object value = property.GetValue(o, 3, "Arg3");

            Assert.AreEqual("CanGetSetComplexIndexer", value);
            Assert.AreEqual(3.0, (double)ThisArg1.GetValue(o));
            Assert.AreEqual("Arg3", ThisArg2.GetValue(o));
        }