예제 #1
0
        public static async Task <ChangeSignatureTestState> CreateAsync(string markup, string languageName, ParseOptions parseOptions = null)
        {
            var workspace = languageName == LanguageNames.CSharp
                  ? await CSharpWorkspaceFactory.CreateWorkspaceFromFileAsync(markup, exportProvider : s_exportProvider, parseOptions : (CSharpParseOptions)parseOptions)
                  : await VisualBasicWorkspaceFactory.CreateWorkspaceFromFileAsync(markup, exportProvider : s_exportProvider, parseOptions : parseOptions, compilationOptions : new VisualBasicCompilationOptions(OutputKind.DynamicallyLinkedLibrary));

            return(new ChangeSignatureTestState(workspace));
        }
예제 #2
0
        public static async Task <ExtractInterfaceTestState> CreateAsync(string markup, string languageName, CompilationOptions compilationOptions)
        {
            var workspace = languageName == LanguageNames.CSharp
                ? await CSharpWorkspaceFactory.CreateWorkspaceFromFileAsync(markup, exportProvider : ExportProvider, compilationOptions : compilationOptions as CSharpCompilationOptions)
                : await VisualBasicWorkspaceFactory.CreateWorkspaceFromFileAsync(markup, exportProvider : ExportProvider, compilationOptions : compilationOptions);

            return(new ExtractInterfaceTestState(workspace));
        }
예제 #3
0
        public static async Task <GenerateTypeTestState> CreateAsync(
            string initial,
            bool isLine,
            string projectToBeModified,
            string typeName,
            string existingFileName,
            string languageName)
        {
            var workspace = languageName == LanguageNames.CSharp
                  ? isLine ? await CSharpWorkspaceFactory.CreateWorkspaceFromFileAsync(initial, exportProvider : s_exportProvider) : await TestWorkspaceFactory.CreateWorkspaceAsync(initial, exportProvider : s_exportProvider)
                  : isLine ? await VisualBasicWorkspaceFactory.CreateWorkspaceFromFileAsync(initial, exportProvider : s_exportProvider) : await TestWorkspaceFactory.CreateWorkspaceAsync(initial, exportProvider : s_exportProvider);

            return(new GenerateTypeTestState(projectToBeModified, typeName, existingFileName, workspace));
        }
 private static Task <TestWorkspace> CreateWorkspaceFromFileAsync(string source, string language, string rootNamespace)
 {
     if (language == LanguageNames.CSharp)
     {
         return(CSharpWorkspaceFactory.CreateWorkspaceFromFileAsync(source));
     }
     else
     {
         return(VisualBasicWorkspaceFactory.CreateWorkspaceFromFileAsync(
                    source,
                    compilationOptions: new VisualBasic.VisualBasicCompilationOptions(
                        OutputKind.DynamicallyLinkedLibrary, rootNamespace: rootNamespace)));
     }
 }
예제 #5
0
 private static async Task <TestWorkspace> CreateWorkspaceFromFileAsync(string file, bool isVisualBasic, ParseOptions parseOptions, CompilationOptions compilationOptions)
 {
     return(isVisualBasic ?
            await VisualBasicWorkspaceFactory.CreateWorkspaceFromFileAsync(file, (VB.VisualBasicParseOptions) parseOptions, (VB.VisualBasicCompilationOptions) compilationOptions) :
            await CSharpWorkspaceFactory.CreateWorkspaceFromFileAsync(file, (CS.CSharpParseOptions) parseOptions, (CS.CSharpCompilationOptions) compilationOptions));
 }