public void SuccessfulCompileFile() { MCSCompiler compiler = new MCSCompiler(_dmcsAssemblyFullPath, new EmptyReportPrinter()); bool compileResult = compiler.Compile(System.IO.Path.Combine(_pathToTestData, "FileWithValidSouceCode.cs")); Assert.IsTrue(compileResult); }
public void TestMethod1() { Stream outputStream = File.OpenWrite("C:\\xml_output.xml"); XMLFormatBuilder xmlBuilder = new XMLFormatBuilder(outputStream); FormatTextVisitor ftv = new FormatTextVisitor(xmlBuilder, null); xmlBuilder.WriteStartDocument(); string _pathToTests = System.Reflection.Assembly.GetExecutingAssembly().Location; _pathToTests = System.IO.Path.GetDirectoryName(_pathToTests); string _dmcsAssemblyFullPath = System.IO.Path.Combine(_pathToTests, "dmcs.exe"); MCSCompiler compiler = new MCSCompiler(_dmcsAssemblyFullPath, new EmptyReportPrinter()); compiler.Compile(_pathToTests + @"\Testdata\FileWithValidSouceCode.cs"); MCSClassElement se = new MCSClassElement("root", compiler.TreeRoot); se.Visit(ftv); xmlBuilder.WriteEndDocument(); xmlBuilder.Close(); outputStream.Close(); }
public override void Process(SourceCodeProject project) { MCSCompiler compiler = new MCSCompiler(Utils.GetDmcsAssemblyPath(), _reporter); if (!compiler.SuccessfulCreated) { return; } _formatter.WriteStartDocument(); _formatter.WriteStartCustomElement("Project", "Name", project.Name); int filesProcessed = 0; DoProgress(0); foreach (SourceFile file in project) { if (!compiler.Compile(file.FileFullPath)) { continue; } FormatTextVisitor visitor = new FormatTextVisitor(_formatter, _processors); _formatter.WriteStartCustomElement("SourceFile", "Name", file.PathInProject); MCSClassElement root = new MCSClassElement("Root", compiler.TreeRoot); root.Visit(visitor); _formatter.WriteEndElement(); filesProcessed++; DoProgress(filesProcessed * 100 / project.FilesCount); } _formatter.WriteEndElement(); _formatter.WriteEndDocument(); }