Ejemplo n.º 1
0
        public void TestBuilder2()
        {
            OopBuilder builder = new OopBuilder();
            var        script  = builder
                                 .Namespace("TestNamespace")
                                 .ChangeToStruct()
                                 .OopAccess(AccessTypes.Private)
                                 .OopName("TestUt2")
                                 .OopBody(@"public static void Test(){}")
                                 .PublicStaticField <string>("Name")
                                 .PrivateStaticField <int>("_age")
                                 .Builder().Script;

            Assert.Equal(@"using System;namespace TestNamespace{private struct TestUt2{public static String Name;private static Int32 _age;public static void Test(){}}}", script);
        }
Ejemplo n.º 2
0
        public void TestBuilder3()
        {
            OopBuilder builder = new OopBuilder();
            var        script  = builder
                                 .Namespace <string>()
                                 .OopAccess("")
                                 .OopName("TestUt3")
                                 .ChangeToInterface()
                                 .Ctor(item => item
                                       .MemberAccess("public")
                                       .Param <string>("name")
                                       .Body("this.Name=name;"))
                                 .OopBody(@"public static void Test(){}")
                                 .PublicStaticField <string>("Name")
                                 .PrivateStaticField <int>("_age")
                                 .Builder().Script;

            Assert.Equal(@"using System;namespace System{interface TestUt3{public static String Name;private static Int32 _age;public static void Test(){}public TestUt3(String name){this.Name=name;}}}", script);
        }