public void TestBuilder1() { OopBuilder builder = new OopBuilder(); var script = builder .Using <DynamicBuilderTest>() .Namespace("TestNamespace") .OopAccess(AccessTypes.Public) .OopModifier(Modifiers.Static) .OopName("TestUt1") .OopBody(@"public static void Test(){}") .PublicStaticField <string>("Name") .PrivateStaticField <int>("_age") .Builder() .Script; Assert.Equal(@"using NatashaUT;using System;namespace TestNamespace{public static class TestUt1{public static String Name;private static Int32 _age;public static void Test(){}}}", script); Assert.Equal("TestUt1", builder.GetType().Name); }
public void Test1() { OopBuilder builder = new OopBuilder(); builder .Using <DynamicBuilderTest>() .Namespace("TestNamespace") .OopAccess(AccessTypes.Public) .OopModifier(Modifiers.Static) .OopName("TestExceptionUt1") .OopBody(@"public static void 1 Test(){}") .PublicStaticField <string>("Name") .PrivateStaticField <int>("_age") .Builder(); var type = builder.GetType(); Assert.Null(type); Assert.Equal(ComplieError.Assembly, builder.Complier.Exception.ErrorFlag); }