示例#1
0
        public static VsServiceManager Setup(VsAppShell instance)
        {
            var serviceManager = new VsServiceManager(instance);

            var catalog = VsTestCompositionCatalog.Current;

            var batch = new CompositionBatch().AddValue <ICoreShell>(instance);

            VsTestCompositionCatalog.Current.Container.Compose(batch);

            serviceManager.CompositionService = catalog.CompositionService;
            serviceManager.ExportProvider     = catalog.ExportProvider;
            serviceManager
            // ICoreShell
            .AddService(instance)
            // MEF
            .AddService(catalog)
            .AddService(catalog.CompositionService)
            .AddService(catalog.ExportProvider)
            // IMainThread and basic services
            .AddService(UIThreadHelper.Instance.MainThread)
            .AddService(Substitute.For <IActionLog>())
            .AddService(Substitute.For <IIdleTimeService>())
            .AddService(new VsApplicationMock())
            .AddService(new SecurityServiceStub())
            .AddService(new MaxLoggingPermissions())
            .AddService(new WindowsFileSystem())
            .AddService <IOutputService, TestOutputService>()
            .AddService(new RegistryImpl())
            .AddService(new ProcessServices())
            .AddService(new TestUIServices(UIThreadHelper.Instance.ProgressDialog))
            .AddService(UIThreadHelper.Instance.TaskService)
            .AddService(new TestPlatformServices())
            .AddService(new RSettingsStub())
            .AddService(new REditorSettings(new TestSettingsStorage()))
            .AddService(new TestImageService())
            .AddService(new VsEditorSupport(serviceManager))
            .AddRComponentsServices()
            .AddWindowsRInterpretersServices()
            .AddWindowsHostClientServices()
            .AddWindowsRComponentsServices()
            // OLE and VS specifics
            .AddService(new TestStatusBar())
            .AddService(new VsRegisterProjectGeneratorsMock(), typeof(SVsRegisterProjectTypes))
            .AddService(VsRegisterEditorsMock.Create(), typeof(SVsRegisterEditors))
            .AddService(new MenuCommandServiceMock(), typeof(IMenuCommandService))
            .AddService(new ComponentModelMock(VsTestCompositionCatalog.Current), typeof(SComponentModel))
            .AddService(new TextManagerMock(), typeof(SVsTextManager))
            .AddService(VsImageServiceMock.Create(), typeof(SVsImageService))
            .AddService(new VsUiShellMock(), typeof(SVsUIShell))
            .AddService(OleComponentManagerMock.Create(), typeof(SOleComponentManager))
            .AddService(VsSettingsManagerMock.Create(), typeof(SVsSettingsManager))
            .AddService(new UIHostLocaleMock(), typeof(SUIHostLocale));

            return(serviceManager);
        }
示例#2
0
 public TestServiceProvider()
 {
     _services.Add(typeof(SVsRegisterProjectTypes), new VsRegisterProjectGeneratorsMock());
     _services.Add(typeof(SVsRegisterEditors), VsRegisterEditorsMock.Create());
     _services.Add(typeof(IMenuCommandService), new MenuCommandServiceMock());
     _services.Add(typeof(SComponentModel), new ComponentModelMock(VsTestCompositionCatalog.Current));
     _services.Add(typeof(SVsTextManager), new TextManagerMock());
     _services.Add(typeof(SVsImageService), VsImageServiceMock.Create());
     _services.Add(typeof(SVsUIShell), new VsUiShellMock());
     _services.Add(typeof(SOleComponentManager), OleComponentManagerMock.Create());
     _services.Add(typeof(SVsSettingsManager), VsSettingsManagerMock.Create());
 }
 protected override void SetupServices(IServiceManager serviceManager, ITestInput testInput)
 {
     base.SetupServices(serviceManager, testInput);
     serviceManager
     .AddService(new VsRegisterProjectGeneratorsMock(), typeof(SVsRegisterProjectTypes))
     .AddService(VsRegisterEditorsMock.Create(), typeof(SVsRegisterEditors))
     .AddService(new MenuCommandServiceMock(), typeof(IMenuCommandService))
     .AddService(new ComponentModelMock(VsTestCompositionCatalog.Current), typeof(SComponentModel))
     .AddService(new TextManagerMock(), typeof(SVsTextManager))
     .AddService(VsImageServiceMock.Create(), typeof(SVsImageService))
     .AddService(new VsUiShellMock(), typeof(SVsUIShell))
     .AddService(OleComponentManagerMock.Create(), typeof(SOleComponentManager))
     .AddService(VsSettingsManagerMock.Create(), typeof(SVsSettingsManager));
 }
示例#4
0
        public static void Setup(VsAppShell instance)
        {
            var serviceManager = instance.Services as VsServiceManager;

            Debug.Assert(!serviceManager.AllServices.Any(), "Test VsAppShell service container must be empty at init time");

            var catalog = VsTestCompositionCatalog.Current;

            var batch = new CompositionBatch().AddValue <ICoreShell>(instance);

            VsTestCompositionCatalog.Current.Container.Compose(batch);

            serviceManager.CompositionService = catalog.CompositionService;
            serviceManager.ExportProvider     = catalog.ExportProvider;
            serviceManager
            // ICoreShell
            .AddService(instance)
            // MEF
            .AddService(catalog)
            .AddService(catalog.CompositionService)
            .AddService(catalog.ExportProvider)
            // IMainThread and basic services
            .AddService(UIThreadHelper.Instance)
            .AddService(Substitute.For <IActionLog>())
            .AddService(new SecurityServiceStub())
            .AddService(new MaxLoggingPermissions())
            .AddService(new WindowsFileSystem())
            .AddService(new RegistryImpl())
            .AddService(new ProcessServices())
            .AddService(new TestUIServices())
            .AddService(new TestTaskService())
            .AddService(new TestPlatformServices())
            .AddService(new TestRToolsSettings())
            .AddService(new REditorSettings(new TestSettingsStorage()))
            .AddService(new TestImageService())
            .AddWindowsRInterpretersServices()
            .AddWindowsHostClientServices()
            // OLE and VS specifics
            .AddService(new VsRegisterProjectGeneratorsMock(), typeof(SVsRegisterProjectTypes))
            .AddService(VsRegisterEditorsMock.Create(), typeof(SVsRegisterEditors))
            .AddService(new MenuCommandServiceMock(), typeof(IMenuCommandService))
            .AddService(new ComponentModelMock(VsTestCompositionCatalog.Current), typeof(SComponentModel))
            .AddService(new TextManagerMock(), typeof(SVsTextManager))
            .AddService(VsImageServiceMock.Create(), typeof(SVsImageService))
            .AddService(new VsUiShellMock(), typeof(SVsUIShell))
            .AddService(OleComponentManagerMock.Create(), typeof(SOleComponentManager))
            .AddService(VsSettingsManagerMock.Create(), typeof(SVsSettingsManager));
        }