Ejemplo n.º 1
0
        [Test] public void QueryableMemberIsInvoked()
        {
            var           queryable = new QueryableClass();
            RuntimeMember method    = RuntimeType.GetInstance(new TypedValue(queryable), new IdentifierName("dynamic"), 1);
            TypedValue    result    = method.Invoke(new object[] { "stuff" });

            Assert.AreEqual("dynamicstuff", result.Value);
        }
Ejemplo n.º 2
0
        [Test] public void MethodWithParmsIsInvoked()
        {
            RuntimeMember method = RuntimeType.GetInstance(new TypedValue(instance), "methodwithparms", 1);

            Assert.IsNotNull(method);
            TypedValue result = method.Invoke(new object[] { "input" });

            Assert.AreEqual("sampleinput", result.Value.ToString());
        }
Ejemplo n.º 3
0
        [Test] public void MethodWithUnderscoresIsInvoked()
        {
            RuntimeMember method = RuntimeType.GetInstance(new TypedValue(instance), "methodwithunderscores", 0);

            Assert.IsNotNull(method);
            TypedValue result = method.Invoke(new object[] {});

            Assert.AreEqual("samplereturn", result.Value.ToString());
        }
Ejemplo n.º 4
0
        [Test] public void IndexerIsInvoked()
        {
            RuntimeMember method = RuntimeType.GetInstance(new TypedValue(instance), "anything", 0);

            Assert.IsNotNull(method);
            TypedValue result = method.Invoke(new object[] {});

            Assert.AreEqual("indexanything", result.Value);
            Assert.AreEqual(typeof(string), result.Type);
        }
Ejemplo n.º 5
0
        [Test] public void MethodWithReturnIsInvoked()
        {
            RuntimeMember method = RuntimeType.GetInstance(new TypedValue(instance), "methodnoparms", 0);

            Assert.IsNotNull(method);
            TypedValue result = method.Invoke(new object[] {});

            Assert.AreEqual("samplereturn", result.Value.ToString());
            Assert.AreEqual(typeof(string), result.Type);
        }
Ejemplo n.º 6
0
        [Test] public void VoidMethodIsInvoked()
        {
            RuntimeMember method = RuntimeType.GetInstance(new TypedValue(instance), "voidmethod", 0);

            Assert.IsNotNull(method);
            TypedValue result = method.Invoke(new object[] {});

            Assert.AreEqual(null, result.Value);
            Assert.AreEqual(typeof(void), result.Type);
        }
Ejemplo n.º 7
0
        [Test] public void PropertySetAndGetIsInvoked()
        {
            RuntimeMember method = RuntimeType.GetInstance(new TypedValue(instance), "property", 1);

            Assert.IsNotNull(method);
            TypedValue result = method.Invoke(new object[] { "stuff" });

            Assert.AreEqual(null, result.Value);
            Assert.AreEqual(typeof(void), result.Type);

            method = RuntimeType.GetInstance(new TypedValue(instance), "property", 0);
            Assert.IsNotNull(method);
            result = method.Invoke(new object[] {});
            Assert.AreEqual("stuff", result.Value.ToString());
            Assert.AreEqual(typeof(string), result.Type);
        }
Ejemplo n.º 8
0
 RuntimeMember GetMethod(string memberName, int count)
 {
     return(RuntimeType.GetInstance(new TypedValue(instance), new IdentifierName(memberName), count));
 }