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; }
private RemoteHostClientServiceFactory.RemoteHostClientService CreateRemoteHostClientService( Workspace workspace = null, IEnumerable<AnalyzerReference> hostAnalyzerReferences = null, IAsynchronousOperationListener listener = 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 listeners = AsynchronousOperationListener.CreateListeners(FeatureAttribute.RemoteHostClient, listener ?? new Listener()); var factory = new RemoteHostClientServiceFactory(listeners, analyzerService); return factory.CreateService(workspace.Services) as RemoteHostClientServiceFactory.RemoteHostClientService; }