コード例 #1
0
        public void TestBuilder2()
        {
            NAssembly assembly = new NAssembly();

            assembly.CreateStruct()
            .Namespace("TestNamespace")
            .Private.OopName("TestUt2")
            .OopBody("public static void Test(){}")
            .PublicStaticField <string>("Name")
            .PrivateStaticField <int>("_age");
            var result = assembly.Check();

            Assert.Equal($@"using System;{Environment.NewLine}namespace TestNamespace{Environment.NewLine}{{{Environment.NewLine}    private struct TestUt2{Environment.NewLine}    {{{Environment.NewLine}        public static String Name;{Environment.NewLine}        private static Int32 _age;{Environment.NewLine}        public static void Test() {{ }}{Environment.NewLine}    }}{Environment.NewLine}}}", result[0].Formatter);
        }
コード例 #2
0
ファイル: OopTest.cs プロジェクト: zhangbo27/Natasha
        public void TestBuilder2()
        {
            NAssembly assembly = new NAssembly();

            assembly.CreateStruct()
            .Namespace("TestNamespace")
            .OopAccess(AccessTypes.Private).OopName("TestUt2")
            .OopBody(@"public static void Test(){}")
            .PublicStaticField <string>("Name")
            .PrivateStaticField <int>("_age");
            var result = assembly.Check();

            Assert.Equal(@"using System;
namespace TestNamespace
{
    private struct TestUt2
    {
        public static String Name;
        private static Int32 _age;
        public static void Test() { }
    }
}", result[0].Formatter);
        }