internal static TestWorkspace CreateWorkspaceFromFiles( string language, CompilationOptions compilationOptions, ParseOptions[] parseOptions, string[] files, ExportProvider exportProvider) { Contract.Requires(parseOptions == null || (files.Length == parseOptions.Length), "Please specify a parse option for each file."); var documentElements = new List<XElement>(); var index = 1; var extension = ""; for (int i = 0; i < files.Length; i++) { if (language == LanguageNames.CSharp) { extension = parseOptions[i].Kind == SourceCodeKind.Regular ? CSharpExtension : CSharpScriptExtension; } else if (language == LanguageNames.VisualBasic) { extension = parseOptions[i].Kind == SourceCodeKind.Regular ? VisualBasicExtension : VisualBasicScriptExtension; } else { extension = language; } documentElements.Add(CreateDocumentElement(files[i], "test" + index++ + extension, parseOptions == null ? null : parseOptions[i])); } var workspaceElement = CreateWorkspaceElement( CreateProjectElement("Test", language, true, parseOptions.FirstOrDefault(), compilationOptions, documentElements)); return CreateWorkspace(workspaceElement, exportProvider: exportProvider); }