コード例 #1
0
        public async Task CodeGenerationOfTypeWithEmbeddedType()
        {
            var    tmpPath = Path.Combine(Path.GetTempPath(), "HyparModels");
            string relEmbeddedSchemaTestPath  = RelativeSavedSchemaPath(embeddedSchemaTest, tmpPath, "embeddedSchemaTest.json");
            string relEmbeddedSchemaTestPath2 = RelativeSavedSchemaPath(embeddedSchemaTest2, tmpPath, "embeddedSchemaTest2.json");

            // Generate the truss type which contains the beam type.
            await TypeGenerator.GenerateUserElementTypesFromUrisAsync(new[] { relEmbeddedSchemaTestPath, relEmbeddedSchemaTestPath2, "https://raw.githubusercontent.com/hypar-io/Schemas/master/FacadePanel.json" }, tmpPath);

            // Ensure that there is only one beam.g.cs in the output.
            Assert.Equal(3, Directory.GetFiles(tmpPath, "*.g.cs").Length);
        }
コード例 #2
0
ファイル: TypeGeneratorTests.cs プロジェクト: kubim/Elements
        public async Task CodeGenerationOfTypeWithEmbeddedType()
        {
            var tmpPath = Path.Combine(Path.GetTempPath(), "HyparModels");

            if (!Directory.Exists(tmpPath))
            {
                Directory.CreateDirectory(tmpPath);
            }

            var embeddedSchemaTestPath    = Path.Combine(tmpPath, "embeddedSchemaTest.json");
            var relEmbeddedSchemaTestPath = Path.GetRelativePath(Assembly.GetExecutingAssembly().Location, embeddedSchemaTestPath);

            File.WriteAllText(embeddedSchemaTestPath, embeddedSchemaTest);

            // Generate the truss type which contains the beam type
            await TypeGenerator.GenerateUserElementTypesFromUrisAsync(new[] { relEmbeddedSchemaTestPath, "https://raw.githubusercontent.com/hypar-io/Schemas/master/FacadePanel.json" }, tmpPath, true);

            // Ensure that there is only one beam.g.cs in the output.
            Assert.Equal(2, Directory.GetFiles(tmpPath, "*.g.cs").Length);
        }