public static Assembly GetAssembly(string sourceCode) { if (sourceCode == null) { throw new ArgumentNullException(nameof(sourceCode)); } var compilation = CompilationFactory.CompileClassFromText(sourceCode); var context = new BeforeCompileContext { Compilation = compilation, Diagnostics = new List <Diagnostic>() }; var module = new TractionCompileModule(); module.BeforeCompile(context); return(GetAssembly(context.Compilation)); }
public static IEnumerable <Diagnostic> GetDiagnostics(CSharpCompilation compilation) { if (compilation == null) { throw new ArgumentNullException(nameof(compilation)); } //Arrange var context = new BeforeCompileContext { Compilation = compilation, Diagnostics = new List <Diagnostic>() }; var module = new TractionCompileModule(); //Act module.BeforeCompile(context); //Return data to be used by assertions return(context.Diagnostics); }