Ejemplo n.º 1
0
        private INuGetUIContext CreateUIContext(params NuGetProject[] projects)
        {
            var packageManager = new NuGetPackageManager(
                SourceRepositoryProvider.Value,
                Settings.Value,
                SolutionManager,
                DeleteOnRestartManager.Value);

            var actionEngine = new UIActionEngine(
                SourceRepositoryProvider.Value,
                packageManager,
                LockService.Value);

            // only pick up at most three integrated package managers
            const int MaxPackageManager       = 3;
            var       packageManagerProviders = PackageManagerProviderUtility.Sort(
                PackageManagerProviders, MaxPackageManager);

            var context = new NuGetUIContext(
                SourceRepositoryProvider.Value,
                SolutionManager,
                packageManager,
                actionEngine,
                PackageRestoreManager.Value,
                OptionsPageActivator.Value,
                SolutionUserOptions,
                packageManagerProviders)
            {
                Projects = projects
            };

            return(context);
        }
        public void PackageManagerProvider_LimitedManagerProviders()
        {
            // Act
            var sorted = PackageManagerProviderUtility.Sort(PackageManagerProviders, 1);

            // Assert
            Assert.Equal(1, sorted.Count);
        }
        public void PackageManagerProvider_SimpleSort()
        {
            // Act
            var sorted = PackageManagerProviderUtility.Sort(PackageManagerProviders, 3);

            // Assert
            Assert.Equal("test-version0", sorted[0].PackageManagerId);
            Assert.Equal("test-version1", sorted[1].PackageManagerId);
            Assert.Equal("test-version2", sorted[2].PackageManagerId);
        }
        public void PackageManagerProvider_DuplicatedManagerId()
        {
            // Act
            var sorted = PackageManagerProviderUtility.Sort(PackageManagerProviders, 3);

            // Assert
            Assert.Equal("testUpdate", sorted[0].PackageManagerName);
            Assert.Equal("test-version1", sorted[1].PackageManagerId);
            Assert.Equal("test-version2", sorted[2].PackageManagerId);
        }
 public VisualStudioUIContextFactory([Import] ISourceRepositoryProvider repositoryProvider,
                                     [Import] ISolutionManager solutionManager,
                                     [Import] ISettings settings,
                                     [Import] IPackageRestoreManager packageRestoreManager,
                                     [Import] IOptionsPageActivator optionsPage,
                                     [Import] IDeleteOnRestartManager deleteOnRestartManager,
                                     [ImportMany] IEnumerable <Lazy <IVsPackageManagerProvider, IOrderable> > packageManagerProviders)
 {
     _repositoryProvider      = repositoryProvider;
     _solutionManager         = solutionManager;
     _restoreManager          = packageRestoreManager;
     _optionsPage             = optionsPage;
     _settings                = settings;
     _deleteOnRestartManager  = deleteOnRestartManager;
     _packageManagerProviders = PackageManagerProviderUtility.Sort(packageManagerProviders, MaxPackageManager);
 }