private static ActiveConfiguredProjectsLoader CreateInstance(UnconfiguredProject project, IUnconfiguredProjectTasksService?tasksService, out ProjectValueDataSource <IConfigurationGroup <ProjectConfiguration> > source)
        {
            var services = IProjectCommonServicesFactory.CreateWithDefaultThreadingPolicy();

            source = ProjectValueDataSourceFactory.Create <IConfigurationGroup <ProjectConfiguration> >(services);
            var activeConfigurationGroupService = IActiveConfigurationGroupServiceFactory.Implement(source);

            var loader = CreateInstance(project, activeConfigurationGroupService, tasksService);

            return(loader);
        }
Esempio n. 2
0
        public DesignTimeInputsChangeTrackerTests()
        {
            var services = IProjectCommonServicesFactory.CreateWithDefaultThreadingPolicy();

            using var designTimeInputsSource = ProjectValueDataSourceFactory.Create <DesignTimeInputs>(services);

            var dataSourceMock = new Mock <IDesignTimeInputsDataSource>();

            dataSourceMock.SetupGet(s => s.SourceBlock)
            .Returns(designTimeInputsSource.SourceBlock);

            using var fileWatcherSource = ProjectValueDataSourceFactory.Create <string[]>(services);

            var watcherMock = new Mock <IDesignTimeInputsFileWatcher>();

            watcherMock.SetupGet(s => s.SourceBlock)
            .Returns(fileWatcherSource.SourceBlock);

            var threadingService           = IProjectThreadingServiceFactory.Create();
            var projectSubscriptionService = IActiveConfiguredProjectSubscriptionServiceFactory.Create();
            var unconfiguredProject        = UnconfiguredProjectFactory.Create(
                filePath: Path.Combine(_projectFolder, "MyTestProj.csproj"),
                projectAsynchronousTasksService: IProjectAsynchronousTasksServiceFactory.Create());

            var unconfiguredProjectServices = IUnconfiguredProjectServicesFactory.Create(
                projectService: IProjectServiceFactory.Create(
                    services: ProjectServicesFactory.Create(
                        threadingService: threadingService)));

            _changeTracker = new DesignTimeInputsChangeTracker(unconfiguredProject,
                                                               unconfiguredProjectServices,
                                                               threadingService,
                                                               projectSubscriptionService,
                                                               dataSourceMock.Object,
                                                               watcherMock.Object)
            {
                AllowSourceBlockCompletion = true
            };


            // Create a block to receive the output
            var receiver = DataflowBlockSlim.CreateActionBlock <IProjectVersionedValue <DesignTimeInputsDelta> >(OutputProduced);

            _changeTracker.SourceBlock.LinkTo(receiver, DataflowOption.PropagateCompletion);
        }
Esempio n. 3
0
        public static IProjectSubscriptionService Create()
        {
            var services      = IProjectCommonServicesFactory.CreateWithDefaultThreadingPolicy();
            var ruleSource    = ProjectValueDataSourceFactory.Create <IProjectSubscriptionUpdate>(services);
            var projectSource = ProjectValueDataSourceFactory.Create <IProjectSnapshot>(services);

            var mock = new Mock <IProjectSubscriptionService>();

            mock.SetupGet(s => s.ProjectRuleSource)
            .Returns(ruleSource);

            mock.SetupGet(s => s.ProjectBuildRuleSource)
            .Returns(ruleSource);

            mock.SetupGet(s => s.ProjectSource)
            .Returns(projectSource);

            mock.SetupGet(s => s.SourceItemsRuleSource)
            .Returns(ruleSource);

            return(mock.Object);
        }
        private static DesignTimeInputsFileWatcher CreateDesignTimeInputsFileWatcher(IVsAsyncFileChangeEx fileChangeService, out ProjectValueDataSource <DesignTimeInputs> source)
        {
            // Create our mock design time inputs data source, but with a source we can actually use
            var services = IProjectCommonServicesFactory.CreateWithDefaultThreadingPolicy();

            source = ProjectValueDataSourceFactory.Create <DesignTimeInputs>(services);

            var mock = new Mock <IDesignTimeInputsDataSource>();

            mock.SetupGet(s => s.SourceBlock)
            .Returns(source.SourceBlock);

            var dataSource = mock.Object;

            var threadingService            = IProjectThreadingServiceFactory.Create();
            var unconfiguredProject         = UnconfiguredProjectFactory.Create(fullPath: @"C:\MyProject\MyProject.csproj");
            var unconfiguredProjectServices = IUnconfiguredProjectServicesFactory.Create(
                projectService: IProjectServiceFactory.Create(
                    services: ProjectServicesFactory.Create(
                        threadingService: threadingService)));

            // Create our class under test
            return(new DesignTimeInputsFileWatcher(unconfiguredProject, unconfiguredProjectServices, threadingService, dataSource, IVsServiceFactory.Create <SVsFileChangeEx, IVsAsyncFileChangeEx>(fileChangeService)));
        }