コード例 #1
0
        public void TestTypeScriptModule()
        {
            var definition = new TypeScriptModuleDefinition();

            definition.Constants.Add(new ConstantDefinition(AccessModifier.Public, "string", "foo", "\"foo value\""));
            definition.Constants.Add(new ConstantDefinition(AccessModifier.Public, "number", "bar", "1000"));
            definition.Constants.Add(new ConstantDefinition(AccessModifier.Public, "boolean", "zaz", "true"));

            TypeScriptModuleBuilder.CreateFiles("C:\\Temp\\CatFactory.TypeScript", string.Empty, "Shipping", true, definition);
        }
コード例 #2
0
        public void TestScaffoldingTypeScriptModule()
        {
            var definition = new TypeScriptModuleDefinition
            {
                Constants =
                {
                    new ConstantDefinition(AccessModifier.Public, "string",  "foo", "'foo value'"),
                    new ConstantDefinition(AccessModifier.Public, "number",  "bar", "1000"),
                    new ConstantDefinition(AccessModifier.Public, "boolean", "zaz", "true")
                }
            };

            TypeScriptModuleBuilder.CreateFiles("C:\\Temp\\CatFactory.TypeScript", string.Empty, "constants", true, definition);
        }
コード例 #3
0
        public void TestScaffoldingNgModuleConfiguration()
        {
            var definition = new TypeScriptModuleDefinition();

            definition.AddImport("NgModule", "@angular/core");
            definition.AddImport("RouterModule", "@angular/router");
            definition.AddImport("AppComponent", "./components/app/app.component");

            var constantLines = new List <ILine>
            {
                new CodeLine(1, "bootstrap: [],"),
                new CodeLine(1, "declarations: [],"),
                new CodeLine(1, "imports: [],"),
                new CodeLine(1, "providers: []")
            };

            definition.Constants.Add(new ConstantDefinition("NgModule", "sharedConfig", new TypeScriptObjectValue(constantLines)));

            TypeScriptModuleBuilder.CreateFiles("C:\\Temp\\CatFactory.TypeScript", string.Empty, "app.module.shared", true, definition);
        }