public void each_BinPath_can_have_multiple_OutputPath() { var output1 = TestHelper.CleanupFolder(_outputFolder.AppendPart("each_BinPath_can_have_multiple_OutputPath").AppendPart("o1"), false); var output2 = TestHelper.CleanupFolder(_outputFolder.AppendPart("each_BinPath_can_have_multiple_OutputPath").AppendPart("o2"), false); var config = new StObjEngineConfiguration(); config.Aspects.Add(new TypeScriptAspectConfiguration()); var b = new BinPathConfiguration(); b.AspectConfigurations.Add(new XElement("TypeScript", new XElement("OutputPath", output1), new XElement("OutputPath", output2))); config.BinPaths.Add(b); var engine = new StObjEngine(TestHelper.Monitor, config); engine.Run(new MonoCollectorResolver(typeof(Simple))).Should().BeTrue("StObjEngine.Run worked."); Directory.Exists(output1).Should().BeTrue(); Directory.Exists(output2).Should().BeTrue(); var f1 = output1.Combine("CK/StObj/TypeScript/Tests/Simple.ts"); var f2 = output2.Combine("CK/StObj/TypeScript/Tests/Simple.ts"); File.Exists(f1).Should().BeTrue(); File.Exists(f2).Should().BeTrue(); var s = File.ReadAllText(f1); s.Should().StartWith("export enum Simple"); s.Should().Be(File.ReadAllText(f2)); }
static NormalizedPath GenerateTSCode(string testName, params Type[] types) { var output = TestHelper.CleanupFolder(_outputFolder.AppendPart(testName), false); var config = new StObjEngineConfiguration(); config.Aspects.Add(new TypeScriptAspectConfiguration()); var b = new BinPathConfiguration(); b.AspectConfigurations.Add(new XElement("TypeScript", new XElement("OutputPath", output))); config.BinPaths.Add(b); var engine = new StObjEngine(TestHelper.Monitor, config); engine.Run(new MonoCollectorResolver(types)).Should().BeTrue("StObjEngine.Run worked."); Directory.Exists(output).Should().BeTrue(); return(output); }
static (NormalizedPath BinTSPath1, NormalizedPath BinTSPath2) GenerateTSCode(string testName, params Type[] types) { var output1 = TestHelper.CleanupFolder(_outputFolder.AppendPart(testName).AppendPart("b1"), false); var output2 = TestHelper.CleanupFolder(_outputFolder.AppendPart(testName).AppendPart("b2"), false); var config = new StObjEngineConfiguration(); config.Aspects.Add(new TypeScriptAspectConfiguration()); var b1 = new BinPathConfiguration(); b1.AspectConfigurations.Add(new XElement("TypeScript", new XElement("OutputPath", output1))); var b2 = new BinPathConfiguration(); b2.AspectConfigurations.Add(new XElement("TypeScript", new XElement("OutputPath", output2))); // b3 has no TypeScript aspect or no OutputPath or an empty OutputPath: nothing must be generated and this is just a warning. var b3 = new BinPathConfiguration(); switch (Environment.TickCount % 3) { case 0: b3.AspectConfigurations.Add(new XElement("TypeScript", new XElement("OutputPath", " "))); break; case 1: b3.AspectConfigurations.Add(new XElement("TypeScript")); break; } config.BinPaths.Add(b1); config.BinPaths.Add(b2); config.BinPaths.Add(b3); var engine = new StObjEngine(TestHelper.Monitor, config); engine.Run(new MonoCollectorResolver(types)).Should().BeTrue("StObjEngine.Run worked."); Directory.Exists(output1).Should().BeTrue(); Directory.Exists(output2).Should().BeTrue(); return(output1, output2); }