public RenamerProjectTreeActionHandler( UnconfiguredProject unconfiguredProject, IUnconfiguredProjectVsServices projectVsServices, [Import(typeof(VisualStudioWorkspace))] Workspace workspace, IEnvironmentOptions environmentOptions, IUserNotificationServices userNotificationServices, IRoslynServices roslynServices, IWaitIndicator waitService, IVsOnlineServices vsOnlineServices, IProjectThreadingService threadingService, IVsUIService <IVsExtensibility, IVsExtensibility3> extensibility, IVsService <SVsOperationProgress, IVsOperationProgressStatusService> operationProgressService, IVsService <SVsSettingsPersistenceManager, ISettingsManager> settingsManagerService) { _unconfiguredProject = unconfiguredProject; _projectVsServices = projectVsServices; _workspace = workspace; _environmentOptions = environmentOptions; _userNotificationServices = userNotificationServices; _roslynServices = roslynServices; _waitService = waitService; _vsOnlineServices = vsOnlineServices; _threadingService = threadingService; _extensibility = extensibility; _operationProgressService = operationProgressService; _settingsManagerService = settingsManagerService; }
public TestRenamerProjectTreeActionHandler( UnconfiguredProject unconfiguredProject, IUnconfiguredProjectVsServices projectVsServices, [Import(typeof(VisualStudioWorkspace))] Workspace workspace, IEnvironmentOptions environmentOptions, IUserNotificationServices userNotificationServices, IRoslynServices roslynServices, IWaitIndicator waitService, IVsOnlineServices vsOnlineServices, IProjectThreadingService threadingService, IVsUIService <IVsExtensibility, IVsExtensibility3> extensibility, IVsService <SVsOperationProgress, IVsOperationProgressStatusService> operationProgressService) : base(unconfiguredProject, projectVsServices, workspace, environmentOptions, userNotificationServices, roslynServices, waitService, vsOnlineServices, threadingService, extensibility, operationProgressService) { }
internal async Task RenameAsync(string sourceCode, string oldFilePath, string newFilePath, IUserNotificationServices userNotificationServices, IRoslynServices roslynServices, IVsOnlineServices vsOnlineServices, string language, IVsService <SVsSettingsPersistenceManager, ISettingsManager> settingsManagerService) { var unconfiguredProject = UnconfiguredProjectFactory.Create(fullPath: $@"C:\project1.{ProjectFileExtension}"); var projectServices = IUnconfiguredProjectVsServicesFactory.Implement( threadingServiceCreator: () => IProjectThreadingServiceFactory.Create(), unconfiguredProjectCreator: () => unconfiguredProject); using var ws = new AdhocWorkspace(); ws.AddSolution(InitializeWorkspace(ProjectId.CreateNewId(), oldFilePath, sourceCode, language)); var environmentOptionsFactory = IEnvironmentOptionsFactory.Implement((string category, string page, string property, bool defaultValue) => { return(true); }); var waitIndicator = (new Mock <IWaitIndicator>()).Object; var projectAsynchronousTasksService = IProjectAsynchronousTasksServiceFactory.Create(); var projectThreadingService = IProjectThreadingServiceFactory.Create(); var refactorNotifyService = (new Mock <IRefactorNotifyService>()).Object; var extensibility = new Mock <IVsUIService <IVsExtensibility, IVsExtensibility3> >().Object; var operationProgressMock = new Mock <IVsService <SVsOperationProgress, IVsOperationProgressStatusService> >().Object; var context = new Mock <IProjectTreeActionHandlerContext>().Object; var mockNode = new Mock <IProjectTree>(); mockNode.SetupGet(x => x.FilePath).Returns(oldFilePath); mockNode.SetupGet(x => x.IsFolder).Returns(false); var node = mockNode.Object; var renamer = new TestRenamerProjectTreeActionHandler(unconfiguredProject, projectServices, ws, environmentOptionsFactory, userNotificationServices, roslynServices, waitIndicator, vsOnlineServices, projectAsynchronousTasksService, projectThreadingService, extensibility, operationProgressMock, settingsManagerService); await renamer.RenameAsync(context, node, newFilePath) .TimeoutAfter(TimeSpan.FromSeconds(1)); }
public TestRenamerProjectTreeActionHandler( UnconfiguredProject unconfiguredProject, IUnconfiguredProjectVsServices projectVsServices, [Import(typeof(VisualStudioWorkspace))] Workspace workspace, IEnvironmentOptions environmentOptions, IUserNotificationServices userNotificationServices, IRoslynServices roslynServices, IWaitIndicator waitService, IVsOnlineServices vsOnlineServices, [Import(ExportContractNames.Scopes.UnconfiguredProject)] IProjectAsynchronousTasksService projectAsynchronousTasksService, IProjectThreadingService threadingService, IVsUIService <IVsExtensibility, IVsExtensibility3> extensibility, IVsService <SVsOperationProgress, IVsOperationProgressStatusService> operationProgressService, IVsService <SVsSettingsPersistenceManager, ISettingsManager> settingsManagerService) : base(unconfiguredProject, projectVsServices, workspace, environmentOptions, userNotificationServices, roslynServices, waitService, vsOnlineServices, projectAsynchronousTasksService, threadingService, extensibility, operationProgressService, settingsManagerService) { }
internal Renamer(IUnconfiguredProjectVsServices projectVsServices, IUnconfiguredProjectTasksService unconfiguredProjectTasksService, [Import(typeof(VisualStudioWorkspace))] Workspace workspace, IVsUIService <Shell.Interop.SDTE, DTE> dte, IEnvironmentOptions environmentOptions, IUserNotificationServices userNotificationServices, IRoslynServices roslynServices, IWaitIndicator waitService, IRefactorNotifyService refactorNotifyService, IVsOnlineServices vsOnlineServices) { _projectVsServices = projectVsServices; _unconfiguredProjectTasksService = unconfiguredProjectTasksService; _workspace = workspace; _dte = dte; _environmentOptions = environmentOptions; _userNotificationServices = userNotificationServices; _roslynServices = roslynServices; _waitService = waitService; _refactorNotifyService = refactorNotifyService; _vsOnlineServices = vsOnlineServices; }
internal async Task RenameAsync(string sourceCode, string oldFilePath, string newFilePath, IUserNotificationServices userNotificationServices, IRoslynServices roslynServices, IVsOnlineServices vsOnlineServices, string language) { using var ws = new AdhocWorkspace(); ws.AddSolution(InitializeWorkspace(ProjectId.CreateNewId(), newFilePath, sourceCode, language)); var unconfiguredProject = UnconfiguredProjectFactory.Create(filePath: $@"C:\project1.{ProjectFileExtension}"); var projectServices = IUnconfiguredProjectVsServicesFactory.Implement( threadingServiceCreator: () => IProjectThreadingServiceFactory.Create(), unconfiguredProjectCreator: () => unconfiguredProject); var unconfiguredProjectTasksService = IUnconfiguredProjectTasksServiceFactory.Create(); var environmentOptionsFactory = IEnvironmentOptionsFactory.Implement((string category, string page, string property, bool defaultValue) => { return(true); }); var waitIndicator = (new Mock <IWaitIndicator>()).Object; var refactorNotifyService = (new Mock <IRefactorNotifyService>()).Object; var dte = IVsUIServiceFactory.Create <Shell.Interop.SDTE, EnvDTE.DTE>(null !); var renamer = new Renamer(projectServices, unconfiguredProjectTasksService, ws, dte, environmentOptionsFactory, userNotificationServices, roslynServices, waitIndicator, refactorNotifyService, vsOnlineServices); await renamer.HandleRenameAsync(oldFilePath, newFilePath) .TimeoutAfter(TimeSpan.FromSeconds(1)); }