public void Constructor_ValueAsProject_SetsProjectProperty()
        {
            var project                           = UnconfiguredProjectFactory.Create();
            var projectTree                       = new Lazy <IPhysicalProjectTree>(() => IPhysicalProjectTreeFactory.Create());
            var threadingService                  = new Lazy <IProjectThreadingService>(() => IProjectThreadingServiceFactory.Create());
            var projectProperties                 = ProjectPropertiesFactory.Create(project);
            var activeConfiguredProject           = ActiveConfiguredProjectFactory.ImplementValue(() => projectProperties.ConfiguredProject);
            var activeConfiguredProjectProperties = ActiveConfiguredProjectFactory.ImplementValue(() => projectProperties);
            var projectAccessor                   = new Lazy <IProjectAccessor>(() => IProjectAccessorFactory.Create());

            var services = new UnconfiguredProjectCommonServices(project, projectTree, threadingService, activeConfiguredProject, activeConfiguredProjectProperties, projectAccessor);

            Assert.Same(project, services.Project);
        }
Exemple #2
0
        public void Constructor_NullAsProject_ThrowsArgumentNull()
        {
            var project                           = UnconfiguredProjectFactory.Create();
            var projectTree                       = new Lazy <IPhysicalProjectTree>(() => IPhysicalProjectTreeFactory.Create());
            var threadingService                  = new Lazy <IProjectThreadingService>(() => IProjectThreadingServiceFactory.Create());
            var projectProperties                 = ProjectPropertiesFactory.Create(project);
            var activeConfiguredProject           = ActiveConfiguredProjectFactory.ImplementValue(() => projectProperties.ConfiguredProject);
            var activeConfiguredProjectProperties = ActiveConfiguredProjectFactory.ImplementValue(() => projectProperties);
            var projectLockService                = new Lazy <IProjectLockService>(() => IProjectLockServiceFactory.Create());

            Assert.Throws <ArgumentNullException>("project", () => {
                new UnconfiguredProjectCommonServices((UnconfiguredProject)null, projectTree, threadingService, activeConfiguredProject, activeConfiguredProjectProperties, projectLockService);
            });
        }
        public void Constructor_ValueAsThreadingService_SetsThreadingServiceProperty()
        {
            var project                           = IUnconfiguredProjectFactory.Create();
            var projectTree                       = new Lazy <IPhysicalProjectTree>(() => IPhysicalProjectTreeFactory.Create());
            var threadingService                  = new Lazy <IProjectThreadingService>(() => IProjectThreadingServiceFactory.Create());
            var projectProperties                 = ProjectPropertiesFactory.Create(project);
            var activeConfiguredProject           = IActiveConfiguredProjectFactory.ImplementValue(() => projectProperties.ConfiguredProject);
            var activeConfiguredProjectProperties = IActiveConfiguredProjectFactory.ImplementValue(() => projectProperties);
            var projectLockService                = new Lazy <IProjectLockService>(() => IProjectLockServiceFactory.Create());

            var services = new UnconfiguredProjectCommonServices(project, projectTree, threadingService, activeConfiguredProject, activeConfiguredProjectProperties, projectLockService);

            Assert.Same(threadingService.Value, services.ThreadingService);
        }
        private MyProjectFolderProjectTreePropertiesProvider CreateInstance(IProjectImageProvider imageProvider, IProjectDesignerService designerService, string appDesignerFolder = "My Project")
        {
            designerService = designerService ?? IProjectDesignerServiceFactory.Create();
            var threadingService  = IProjectThreadingServiceFactory.Create();
            var project           = IUnconfiguredProjectFactory.Create();
            var projectProperties = ProjectPropertiesFactory.Create(project,
                                                                    new PropertyPageData()
            {
                Category     = nameof(ConfigurationGeneral),
                PropertyName = nameof(ConfigurationGeneral.AppDesignerFolder),
                Value        = appDesignerFolder
            });

            var projectServices = IUnconfiguredProjectCommonServicesFactory.Create(project, threadingService, projectProperties.ConfiguredProject, projectProperties);

            return(new MyProjectFolderProjectTreePropertiesProvider(imageProvider ?? IProjectImageProviderFactory.Create(), projectServices, designerService));
        }
        public async Task AppManifestSpecialFileProvider_Test(string input, string appManifestPropertyValue, string expectedFilePath)
        {
            var inputTree = ProjectTreeParser.Parse(input);

            var projectTreeProvider = IProjectTreeProviderFactory.Create(@"C:\Foo\Properties", (root, path) =>
            {
                root.TryFindImmediateChild(Path.GetFileName(path), out var node);
                return(node);
            });
            var projectTree         = IPhysicalProjectTreeFactory.Create(currentTree: inputTree, provider: projectTreeProvider);
            var sourceItemsProvider = IProjectItemProviderFactory.Create();
            var fileSystem          = IFileSystemFactory.Create(path => true);
            var specialFilesManager = ISpecialFilesManagerFactory.Create();

            var properties = ProjectPropertiesFactory.Create(UnconfiguredProjectFactory.Create(), new PropertyPageData {
                Category     = ConfigurationGeneralBrowseObject.SchemaName,
                PropertyName = ConfigurationGeneralBrowseObject.ApplicationManifestProperty,
                Value        = appManifestPropertyValue
            });
            var provider = new AppManifestSpecialFileProvider(projectTree, sourceItemsProvider, null, fileSystem, specialFilesManager, properties);
            var filePath = await provider.GetFileAsync(SpecialFiles.AppSettings, SpecialFileFlags.CreateIfNotExist);

            Assert.Equal(expectedFilePath, filePath);
        }