Esempio n. 1
0
        public void ReturnValue()
        {
            var lamdaExpression = Helper.GetLamdaExpression("InvocationTestClass", "ReturnValue");

            var del = lamdaExpression.Compile();

            var instance = new InvocationTestClass();

            var returnValue = del.DynamicInvoke(instance);

            returnValue.Should().Be("hello");
        }
Esempio n. 2
0
        public void WhenInstanceMethodCalledWithThisKeyword()
        {
            var lamdaExpression = Helper.GetLamdaExpression("InvocationTestClass", "InvokeInstanceMethodWithThisKeyword");

            var del = lamdaExpression.Compile();

            var instance = new InvocationTestClass("hello");

            del.DynamicInvoke(instance);

            Tracker.LastValue.Should().Be("hello");
        }
Esempio n. 3
0
        public void InvokeMethodWithNamespace()
        {
            var lamdaExpression = Helper.GetLamdaExpression("InvocationTestClass", "InvokeMethodWithNamespace");

            var del = lamdaExpression.Compile();

            var instance = new InvocationTestClass();

            del.DynamicInvoke(instance);

            Tracker.LastValue.Should().Be("hello");
        }
Esempio n. 4
0
        public void WhenChainMethodInvoke5Times()
        {
            var lamdaExpression = Helper.GetLamdaExpression("InvocationTestClass", "InvokeChainMethod5Times");

            var del = lamdaExpression.Compile();

            var instance = new InvocationTestClass();

            del.DynamicInvoke(instance);

            Tracker.LastValue.Should().Be(5);
        }
Esempio n. 5
0
        public void WhenInvokeMemberMethod()
        {
            var lamdaExpression = Helper.GetLamdaExpression("InvocationTestClass", "InvokeMemberMethod");

            var del = lamdaExpression.Compile();

            var instance = new InvocationTestClass();

            del.DynamicInvoke(instance);

            Tracker.MethodCalled.Should().BeTrue();
        }
Esempio n. 6
0
        public void WhenInokeStaticMethodWithPropertyArgument()
        {
            var lamdaExpression = Helper.GetLamdaExpression("InvocationTestClass", "InokeStaticMethodWithPropertyArgument");

            var del = lamdaExpression.Compile();

            var instance = new InvocationTestClass("hello");

            del.DynamicInvoke(instance);

            Tracker.LastValue.Should().Be("hello");
        }
Esempio n. 7
0
        public void InvokeOptionalNamedParameterMethod()
        {
            var lamdaExpression = Helper.GetLamdaExpression("InvocationTestClass", "InvokeOptionalNamedParameterMethod");

            var del = lamdaExpression.Compile();

            var instance = new InvocationTestClass();

            del.DynamicInvoke(instance);

            Tracker.LastValue.Should().Be("hello1");
        }