public static void MakerCode3() { var builder = FakeMethodOperator.Random(); builder .UseMethod(typeof(OopTestModel).GetMethod("ReWrite3")) .Methodbody(@"i++;temp+=i.ToString();"); Assert.Equal($@"public virtual void ReWrite3(ref System.Int32 i,System.String temp){{i++;temp+=i.ToString();}}", builder.Script); }
public static void MakerCode2() { var builder = FakeMethodOperator.Random(); builder .UseMethod(typeof(OopTestModel).GetMethod("ReWrite2")) .Methodbody(@"Console.WriteLine(""hello world"");return this;"); Assert.Equal($@"public async System.Threading.Tasks.Task<NatashaUT.Model.OopTestModel> ReWrite2(){{Console.WriteLine(""hello world"");return this;}}", builder.Script); }
public static void MakerStaticCode2() { var builder = FakeMethodOperator.Random() .UseMethod(typeof(OopTestModel).GetMethod("ReWrite2")) .StaticMethodBody(@"Console.WriteLine(""hello world"");return default;"); Assert.Equal($@"public static async System.Threading.Tasks.Task<NatashaUT.Model.OopTestModel> ReWrite2(){{Console.WriteLine(""hello world"");return default;}}", builder.Script); Assert.NotNull(builder.Compile()); }
public static void MakerCode1() { var builder = FakeMethodOperator.Random(); builder .UseMethod(typeof(OopTestModel).GetMethod("ReWrite1")) .Methodbody(@"Console.WriteLine(""hello world"");"); Assert.Equal($@"public void ReWrite1(){{Console.WriteLine(""hello world"");}}", builder.Script); }
public static void MakerStaticCode3() { var builder = FakeMethodOperator.Random(); builder .UseMethod(typeof(OopTestModel).GetMethod("ReWrite3")) .StaticMethodBody(@"i++;temp+=i.ToString();"); Assert.Equal($@"public static void ReWrite3(ref System.Int32 i,System.String temp){{i++;temp+=i.ToString();}}", builder.Script); Assert.NotNull(builder.Compile <TestDelegate>()); }