示例#1
0
 public WorkspaceProjectContextProvider(UnconfiguredProject project,
                                        IProjectThreadingService threadingService,
                                        ISafeProjectGuidService projectGuidService,
                                        ITelemetryService telemetryService,
                                        Lazy <IWorkspaceProjectContextFactory> workspaceProjectContextFactory,        // From Roslyn, so lazy
                                        IActiveWorkspaceProjectContextTracker activeWorkspaceProjectContextTracker)
 {
     _project          = project;
     _threadingService = threadingService;
     _telemetryService = telemetryService;
     _workspaceProjectContextFactory       = workspaceProjectContextFactory;
     _activeWorkspaceProjectContextTracker = activeWorkspaceProjectContextTracker;
     _projectGuidService = projectGuidService;
 }
 public WorkspaceContextHostInstance(ConfiguredProject project,
                                     IProjectThreadingService threadingService,
                                     IUnconfiguredProjectTasksService tasksService,
                                     IProjectSubscriptionService projectSubscriptionService,
                                     IWorkspaceProjectContextProvider workspaceProjectContextProvider,
                                     IActiveWorkspaceProjectContextTracker activeWorkspaceProjectContextTracker,
                                     ExportFactory <IApplyChangesToWorkspaceContext> applyChangesToWorkspaceContextFactory)
     : base(threadingService.JoinableTaskContext)
 {
     _project = project;
     _projectSubscriptionService = projectSubscriptionService;
     _threadingService           = threadingService;
     _tasksService = tasksService;
     _workspaceProjectContextProvider       = workspaceProjectContextProvider;
     _applyChangesToWorkspaceContextFactory = applyChangesToWorkspaceContextFactory;
     _activeWorkspaceProjectContextTracker  = activeWorkspaceProjectContextTracker;
 }
示例#3
0
        private WorkspaceContextHostInstance CreateInstance(ConfiguredProject project = null, IProjectThreadingService threadingService = null, IUnconfiguredProjectTasksService tasksService = null, IProjectSubscriptionService projectSubscriptionService = null, IActiveWorkspaceProjectContextTracker activeWorkspaceProjectContextTracker = null, IWorkspaceProjectContextProvider workspaceProjectContextProvider = null, IApplyChangesToWorkspaceContext applyChangesToWorkspaceContext = null)
        {
            project                              = project ?? ConfiguredProjectFactory.Create();
            threadingService                     = threadingService ?? IProjectThreadingServiceFactory.Create();
            tasksService                         = tasksService ?? IUnconfiguredProjectTasksServiceFactory.Create();
            projectSubscriptionService           = projectSubscriptionService ?? IProjectSubscriptionServiceFactory.Create();
            activeWorkspaceProjectContextTracker = activeWorkspaceProjectContextTracker ?? IActiveWorkspaceProjectContextTrackerFactory.Create();
            workspaceProjectContextProvider      = workspaceProjectContextProvider ?? IWorkspaceProjectContextProviderFactory.ImplementCreateProjectContextAsync(IWorkspaceProjectContextMockFactory.Create());
            applyChangesToWorkspaceContext       = applyChangesToWorkspaceContext ?? IApplyChangesToWorkspaceContextFactory.Create();

            return(new WorkspaceContextHostInstance(project,
                                                    threadingService,
                                                    tasksService,
                                                    projectSubscriptionService,
                                                    workspaceProjectContextProvider,
                                                    activeWorkspaceProjectContextTracker,
                                                    ExportFactoryFactory.ImplementCreateValueWithAutoDispose(() => applyChangesToWorkspaceContext)));
        }
示例#4
0
        private async Task <WorkspaceContextHostInstance> CreateInitializedInstanceAsync(ConfiguredProject project = null, IProjectThreadingService threadingService = null, IUnconfiguredProjectTasksService tasksService = null, IProjectSubscriptionService projectSubscriptionService = null, IActiveWorkspaceProjectContextTracker activeWorkspaceProjectContextTracker = null, IWorkspaceProjectContextProvider workspaceProjectContextProvider = null, IApplyChangesToWorkspaceContext applyChangesToWorkspaceContext = null)
        {
            var instance = CreateInstance(project, threadingService, tasksService, projectSubscriptionService, activeWorkspaceProjectContextTracker, workspaceProjectContextProvider, applyChangesToWorkspaceContext);

            await instance.InitializeAsync();

            return(instance);
        }
        private static WorkspaceProjectContextProvider CreateInstance(UnconfiguredProject project = null, IProjectThreadingService threadingService = null, IWorkspaceProjectContextFactory workspaceProjectContextFactory = null, IActiveWorkspaceProjectContextTracker activeWorkspaceProjectContextTracker = null, ISafeProjectGuidService projectGuidService = null, IProjectRuleSnapshot projectRuleSnapshot = null)
        {
            projectRuleSnapshot = projectRuleSnapshot ?? IProjectRuleSnapshotFactory.FromJson(
                @"{
    ""Properties"": {
        ""MSBuildProjectFullPath"": ""C:\\Project\\Project.csproj"",
        ""LanguageServiceName"": ""CSharp"",
        ""TargetPath"": ""C:\\Target.dll""
    }
}");

            var telemetryService = ITelemetryServiceFactory.Create();

            project          = project ?? UnconfiguredProjectFactory.Create();
            threadingService = threadingService ?? IProjectThreadingServiceFactory.Create();
            workspaceProjectContextFactory       = workspaceProjectContextFactory ?? IWorkspaceProjectContextFactoryFactory.Create();
            activeWorkspaceProjectContextTracker = activeWorkspaceProjectContextTracker ?? IActiveWorkspaceProjectContextTrackerFactory.Create();
            projectGuidService = projectGuidService ?? ISafeProjectGuidServiceFactory.ImplementGetProjectGuidAsync(Guid.NewGuid());

            var mock = new Mock <WorkspaceProjectContextProvider>(project, threadingService, projectGuidService, telemetryService, workspaceProjectContextFactory.AsLazy(), activeWorkspaceProjectContextTracker);

            mock.Protected().Setup <Task <IProjectRuleSnapshot> >("GetLatestSnapshotAsync", ItExpr.IsAny <ConfiguredProject>())
            .ReturnsAsync(projectRuleSnapshot);

            return(mock.Object);
        }