예제 #1
0
        private RemoteHostClientServiceFactory.RemoteHostClientService CreateRemoteHostClientService(
            Workspace workspace = null,
            IAsynchronousOperationListenerProvider listenerProvider = null)
        {
            workspace ??= new AdhocWorkspace(TestHostServices.CreateHostServices());
            workspace.TryApplyChanges(workspace.CurrentSolution.WithOptions(workspace.Options
                                                                            .WithChangedOption(RemoteHostOptions.RemoteHostTest, true)
                                                                            .WithChangedOption(SolutionCrawlerOptions.BackgroundAnalysisScopeOption, LanguageNames.CSharp, BackgroundAnalysisScope.FullSolution)
                                                                            .WithChangedOption(SolutionCrawlerOptions.BackgroundAnalysisScopeOption, LanguageNames.VisualBasic, BackgroundAnalysisScope.FullSolution)));

            var threadingContext = ((IMefHostExportProvider)workspace.Services.HostServices).GetExports <IThreadingContext>().Single().Value;
            var factory          = new RemoteHostClientServiceFactory(threadingContext, listenerProvider ?? AsynchronousOperationListenerProvider.NullProvider);

            return(factory.CreateService(workspace.Services) as RemoteHostClientServiceFactory.RemoteHostClientService);
        }
예제 #2
0
        private RemoteHostClientServiceFactory.RemoteHostClientService CreateRemoteHostClientService(
            Workspace workspace = null,
            IEnumerable <AnalyzerReference> hostAnalyzerReferences  = null,
            IAsynchronousOperationListenerProvider listenerProvider = null)
        {
            workspace         = workspace ?? new AdhocWorkspace(TestHostServices.CreateHostServices());
            workspace.Options = workspace.Options.WithChangedOption(RemoteHostOptions.RemoteHostTest, true)
                                .WithChangedOption(ServiceFeatureOnOffOptions.ClosedFileDiagnostic, LanguageNames.CSharp, true)
                                .WithChangedOption(ServiceFeatureOnOffOptions.ClosedFileDiagnostic, LanguageNames.VisualBasic, true);

            var analyzerService = GetDiagnosticAnalyzerService(hostAnalyzerReferences ?? SpecializedCollections.EmptyEnumerable <AnalyzerReference>());

            var factory = new RemoteHostClientServiceFactory(listenerProvider ?? AsynchronousOperationListenerProvider.NullProvider, analyzerService);

            return(factory.CreateService(workspace.Services) as RemoteHostClientServiceFactory.RemoteHostClientService);
        }
예제 #3
0
        private RemoteHostClientServiceFactory.RemoteHostClientService CreateRemoteHostClientService(
            Workspace workspace = null,
            IEnumerable <AnalyzerReference> hostAnalyzerReferences  = null,
            IAsynchronousOperationListenerProvider listenerProvider = null)
        {
            workspace         = workspace ?? new AdhocWorkspace(TestHostServices.CreateHostServices());
            workspace.Options = workspace.Options.WithChangedOption(RemoteHostOptions.RemoteHostTest, true)
                                .WithChangedOption(SolutionCrawlerOptions.BackgroundAnalysisScopeOption, LanguageNames.CSharp, BackgroundAnalysisScope.FullSolution)
                                .WithChangedOption(SolutionCrawlerOptions.BackgroundAnalysisScopeOption, LanguageNames.VisualBasic, BackgroundAnalysisScope.FullSolution);

            var analyzerService = GetDiagnosticAnalyzerService(hostAnalyzerReferences ?? SpecializedCollections.EmptyEnumerable <AnalyzerReference>());

            var threadingContext = ((IMefHostExportProvider)workspace.Services.HostServices).GetExports <IThreadingContext>().Single().Value;
            var factory          = new RemoteHostClientServiceFactory(threadingContext, listenerProvider ?? AsynchronousOperationListenerProvider.NullProvider, analyzerService);

            return(factory.CreateService(workspace.Services) as RemoteHostClientServiceFactory.RemoteHostClientService);
        }
        private RemoteHostClientServiceFactory.RemoteHostClientService CreateRemoteHostClientService(Workspace workspace = null, IEnumerable <AnalyzerReference> hostAnalyzerReferences = null)
        {
            workspace         = workspace ?? new AdhocWorkspace(TestHostServices.CreateHostServices());
            workspace.Options = workspace.Options.WithChangedOption(RemoteHostOptions.RemoteHostTest, true)
                                .WithChangedOption(ServiceFeatureOnOffOptions.ClosedFileDiagnostic, LanguageNames.CSharp, true)
                                .WithChangedOption(ServiceFeatureOnOffOptions.ClosedFileDiagnostic, LanguageNames.VisualBasic, true);

            var analyzerService = GetDiagnosticAnalyzerService(hostAnalyzerReferences ?? SpecializedCollections.EmptyEnumerable <AnalyzerReference>());

            var optionMock        = new Mock <IEditorOptions>(MockBehavior.Strict);
            var optionFactoryMock = new Mock <IEditorOptionsFactoryService>(MockBehavior.Strict);

            optionFactoryMock.SetupGet(i => i.GlobalOptions).Returns(optionMock.Object);

            var factory = new RemoteHostClientServiceFactory(analyzerService, optionFactoryMock.Object);

            return(factory.CreateService(workspace.Services) as RemoteHostClientServiceFactory.RemoteHostClientService);
        }