예제 #1
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));
        }
예제 #2
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));
        }