public static IEnumerable <Project> ShowProjectSelectorWindow(
     this IUserNotifierServices userNotifierServices,
     string instructionText,
     Predicate <Project> checkedStateSelector)
 {
     return(userNotifierServices.ShowProjectSelectorWindow(
                instructionText,
                package: null,
                checkedStateSelector: checkedStateSelector,
                enabledStateSelector: ignore => true));
 }
예제 #2
0
 public SolutionInstalledProvider(
     IVsPackageManager packageManager,
     IPackageRepository localRepository,
     ResourceDictionary resources,
     ProviderServices providerServices,
     IProgressProvider progressProvider,
     ISolutionManager solutionManager,
     IPackageRestoreManager packageRestoreManager)
     : base(packageManager, null, localRepository, resources, providerServices, progressProvider, solutionManager, packageRestoreManager)
 {
     _userNotifierServices = providerServices.UserNotifierServices;
 }
예제 #3
0
 public SolutionInstalledProvider(
     IVsPackageManager packageManager,
     IPackageRepository localRepository,
     ResourceDictionary resources,
     ProviderServices providerServices,
     IProgressProvider progressProvider,
     ISolutionManager solutionManager,
     IPackageRestoreManager packageRestoreManager)
     : base(packageManager, null, localRepository, resources, providerServices, progressProvider, solutionManager, packageRestoreManager)
 {
     _userNotifierServices = providerServices.UserNotifierServices;
 }
예제 #4
0
 public ProviderServices(
     IUserNotifierServices userNotifierServices,
     IProgressWindowOpener progressWindow,
     IProviderSettings selectedProviderSettings,
     IScriptExecutor scriptExecutor,
     IOutputConsoleProvider outputConsoleProvider,
     IVsCommonOperations vsCommonOperations)
 {
     UserNotifierServices = userNotifierServices;
     ProgressWindow = progressWindow;
     ScriptExecutor = scriptExecutor;
     OutputConsoleProvider = outputConsoleProvider;
     ProviderSettings = selectedProviderSettings;
     VsCommonOperations = vsCommonOperations;
 }
예제 #5
0
 public ProviderServices(
     IUserNotifierServices userNotifierServices,
     IProgressWindowOpener progressWindow,
     IProviderSettings selectedProviderSettings,
     IScriptExecutor scriptExecutor,
     IOutputConsoleProvider outputConsoleProvider,
     IVsCommonOperations vsCommonOperations)
 {
     UserNotifierServices  = userNotifierServices;
     ProgressWindow        = progressWindow;
     ScriptExecutor        = scriptExecutor;
     OutputConsoleProvider = outputConsoleProvider;
     ProviderSettings      = selectedProviderSettings;
     VsCommonOperations    = vsCommonOperations;
 }
예제 #6
0
        public InstalledProvider(
            IVsPackageManager packageManager,
            Project project,
            IPackageRepository localRepository,
            ResourceDictionary resources,
            ProviderServices providerServices,
            IProgressProvider progressProvider,
            ISolutionManager solutionManager)
            : base(localRepository, resources, providerServices, progressProvider, solutionManager)
        {

            if (packageManager == null)
            {
                throw new ArgumentNullException("packageManager");
            }

            _packageManager = packageManager;
            _project = project;
            _userNotifierServices = providerServices.UserNotifierServices;
        }
예제 #7
0
 public SolutionOnlineProvider(
     IPackageRepository localRepository,
     ResourceDictionary resources,
     IPackageRepositoryFactory packageRepositoryFactory,
     IPackageSourceProvider packageSourceProvider,
     IVsPackageManagerFactory packageManagerFactory,
     ProviderServices providerServices,
     IProgressProvider progressProvider,
     ISolutionManager solutionManager) :
     base(null,
         localRepository,
         resources,
         packageRepositoryFactory,
         packageSourceProvider,
         packageManagerFactory,
         providerServices,
         progressProvider,
         solutionManager)
 {
     _userNotifierServices = providerServices.UserNotifierServices;
 }
예제 #8
0
 public SolutionOnlineProvider(
     IPackageRepository localRepository,
     ResourceDictionary resources,
     IPackageRepositoryFactory packageRepositoryFactory,
     IPackageSourceProvider packageSourceProvider,
     IVsPackageManagerFactory packageManagerFactory,
     ProviderServices providerServices,
     IProgressProvider progressProvider,
     ISolutionManager solutionManager) :
     base(null,
          localRepository,
          resources,
          packageRepositoryFactory,
          packageSourceProvider,
          packageManagerFactory,
          providerServices,
          progressProvider,
          solutionManager)
 {
     _userNotifierServices = providerServices.UserNotifierServices;
 }
예제 #9
0
        public InstalledProvider(
            IVsPackageManager packageManager,
            Project project,
            IPackageRepository localRepository,
            ResourceDictionary resources,
            ProviderServices providerServices,
            IProgressProvider progressProvider,
            ISolutionManager solutionManager,
            IPackageRestoreManager packageRestoreManager)
            : base(localRepository, resources, providerServices, progressProvider, solutionManager)
        {
            if (packageManager == null)
            {
                throw new ArgumentNullException("packageManager");
            }

            _packageManager = packageManager;
            _project = project;
            _targetFramework = _project.GetTargetFrameworkName();
            _userNotifierServices = providerServices.UserNotifierServices;
            _packageRestoreManager = packageRestoreManager;
            _packageRestoreManager.PackagesMissingStatusChanged += OnMissPackagesChanged;
        }
예제 #10
0
        public InstalledProvider(
            IVsPackageManager packageManager,
            Project project,
            IPackageRepository localRepository,
            ResourceDictionary resources,
            ProviderServices providerServices,
            IProgressProvider progressProvider,
            ISolutionManager solutionManager,
            IPackageRestoreManager packageRestoreManager)
            : base(localRepository, resources, providerServices, progressProvider, solutionManager)
        {
            if (packageManager == null)
            {
                throw new ArgumentNullException("packageManager");
            }

            _packageManager        = packageManager;
            _project               = project;
            _targetFramework       = _project.GetTargetFrameworkName();
            _userNotifierServices  = providerServices.UserNotifierServices;
            _packageRestoreManager = packageRestoreManager;
            _packageRestoreManager.PackagesMissingStatusChanged += OnMissPackagesChanged;
        }
예제 #11
0
        private static SolutionUpdatesProvider CreateSolutionUpdatesProvider(
            IVsPackageManager packageManager = null,
            IPackageRepository localRepository = null,
            IPackageRepositoryFactory repositoryFactory = null,
            IPackageSourceProvider packageSourceProvider = null,
            IScriptExecutor scriptExecutor = null,
            ISolutionManager solutionManager = null,
            IUserNotifierServices userNotifierServices = null)
        {

            if (packageManager == null)
            {
                var packageManagerMock = new Mock<IVsPackageManager>();
                var sourceRepository = new MockPackageRepository();
                packageManagerMock.Setup(p => p.SourceRepository).Returns(sourceRepository);

                packageManager = packageManagerMock.Object;
            }

            if (repositoryFactory == null)
            {
                var repositoryFactoryMock = new Mock<IPackageRepositoryFactory>();
                repositoryFactoryMock.Setup(p => p.CreateRepository(It.IsAny<string>())).Returns(new MockPackageRepository());
                repositoryFactory = repositoryFactoryMock.Object;
            }

            if (packageSourceProvider == null)
            {
                var packageSourceProviderMock = new Mock<IPackageSourceProvider>();
                packageSourceProviderMock.Setup(p => p.LoadPackageSources()).Returns(
                        new PackageSource[2] {
                            new PackageSource("Test1", "One"),
                            new PackageSource("Test2", "Two")
                        }
                    );
                packageSourceProvider = packageSourceProviderMock.Object;
            }

            var factory = new Mock<IVsPackageManagerFactory>();
            factory.Setup(m => m.CreatePackageManager(It.IsAny<IPackageRepository>(), true)).Returns(packageManager);

            var mockProgressWindowOpener = new Mock<IProgressWindowOpener>();

            if (userNotifierServices == null)
            {
                var mockWindowServices = new Mock<IUserNotifierServices>();
                userNotifierServices = mockWindowServices.Object;
            }

            if (scriptExecutor == null)
            {
                scriptExecutor = new Mock<IScriptExecutor>().Object;
            }

            if (solutionManager == null)
            {
                solutionManager = new Mock<ISolutionManager>().Object;
            }

            if (userNotifierServices == null)
            {
                userNotifierServices = new Mock<IUserNotifierServices>().Object;
            }

            var services = new ProviderServices(
                userNotifierServices,
                mockProgressWindowOpener.Object,
                new Mock<IProviderSettings>().Object,
                new Mock<IUpdateAllUIService>().Object,
                scriptExecutor,
                new MockOutputConsoleProvider(),
                new Mock<IVsCommonOperations>().Object
            );

            if (localRepository == null)
            {
                localRepository = new Mock<IPackageRepository>().Object;
            }

            return new SolutionUpdatesProvider(
                localRepository,
                new System.Windows.ResourceDictionary(),
                repositoryFactory,
                packageSourceProvider,
                factory.Object,
                services,
                new Mock<IProgressProvider>().Object,
                solutionManager);
        }
예제 #12
0
        private static SolutionOnlineProvider CreateSolutionOnlineProvider(
            IVsPackageManager packageManager             = null,
            IPackageRepository localRepository           = null,
            IPackageRepositoryFactory repositoryFactory  = null,
            IPackageSourceProvider packageSourceProvider = null,
            IScriptExecutor scriptExecutor             = null,
            ISolutionManager solutionManager           = null,
            IUserNotifierServices userNotifierServices = null)
        {
            if (packageManager == null)
            {
                var packageManagerMock = new Mock <IVsPackageManager>();
                var sourceRepository   = new MockPackageRepository();
                packageManagerMock.Setup(p => p.SourceRepository).Returns(sourceRepository);

                packageManager = packageManagerMock.Object;
            }

            if (repositoryFactory == null)
            {
                var repositoryFactoryMock = new Mock <IPackageRepositoryFactory>();
                repositoryFactoryMock.Setup(p => p.CreateRepository(It.IsAny <string>())).Returns(new MockPackageRepository());
                repositoryFactory = repositoryFactoryMock.Object;
            }

            if (packageSourceProvider == null)
            {
                var packageSourceProviderMock = new Mock <IPackageSourceProvider>();
                packageSourceProviderMock.Setup(p => p.LoadPackageSources()).Returns(
                    new PackageSource[2] {
                    new PackageSource("Test1", "One"),
                    new PackageSource("Test2", "Two")
                }
                    );
                packageSourceProvider = packageSourceProviderMock.Object;
            }

            var factory = new Mock <IVsPackageManagerFactory>();

            factory.Setup(m => m.CreatePackageManager(It.IsAny <IPackageRepository>(), true)).Returns(packageManager);

            var mockProgressWindowOpener = new Mock <IProgressWindowOpener>();

            if (scriptExecutor == null)
            {
                scriptExecutor = new Mock <IScriptExecutor>().Object;
            }

            if (solutionManager == null)
            {
                solutionManager = new Mock <ISolutionManager>().Object;
            }

            if (userNotifierServices == null)
            {
                var mockWindowServices = new Mock <IUserNotifierServices>();
                mockWindowServices.Setup(p => p.ShowProjectSelectorWindow(
                                             It.IsAny <string>(),
                                             It.IsAny <IPackage>(),
                                             It.IsAny <Predicate <Project> >(),
                                             It.IsAny <Predicate <Project> >()))
                .Returns(solutionManager.GetProjects());
                userNotifierServices = mockWindowServices.Object;
            }

            var services = new ProviderServices(
                userNotifierServices,
                mockProgressWindowOpener.Object,
                new Mock <IProviderSettings>().Object,
                scriptExecutor,
                new MockOutputConsoleProvider(),
                new Mock <IVsCommonOperations>().Object
                );

            if (localRepository == null)
            {
                localRepository = new Mock <IPackageRepository>().Object;
            }

            return(new SolutionOnlineProvider(
                       localRepository,
                       new System.Windows.ResourceDictionary(),
                       repositoryFactory,
                       packageSourceProvider,
                       factory.Object,
                       services,
                       new Mock <IProgressProvider>().Object,
                       solutionManager));
        }