Пример #1
0
 public void Clone()
 {
     var action = NewMethod.Create <Func <Test, Test> >(builder =>
                                                        builder
                                                        .MethodBody(@"
            
 
     "));
 }
Пример #2
0
        public void TestBuilder2()
        {
            var result = NewMethod.Create <Func <Type> >(builder => builder
                                                         .Using("NatashaUT.Model")
                                                         .MethodBody($@"return typeof(FieldSelfLinkModel);")
                                                         );

            Assert.NotNull(result.Method());
            Assert.Equal(typeof(FieldSelfLinkModel), result.Method());
        }
Пример #3
0
        public static async void RunAsyncDelegate3()
        {
            var delegateAction = NewMethod.Create <Func <string, string, Task <string> > >(builder => builder
                                                                                           .UseAsync()
                                                                                           .MethodBody(@"
                            string result = arg1 +"" ""+ arg2;
                            Console.WriteLine(result);
                            return result;")
                                                                                           );

            string result = await delegateAction.Method("Hello", "World2!");

            Assert.Equal("Hello World2!", result);
        }