public override IEnumerable<PackageOperation> GetInstallPackageOperations(IPackage package, InstallPackageAction installAction)
		{
			if (ExceptionToThrowWhenGetInstallPackageOperationsCalled != null) {
				throw ExceptionToThrowWhenGetInstallPackageOperationsCalled;
			}
			return base.GetInstallPackageOperations(package, installAction);
		}
		public void InstallPackage(IPackage package, InstallPackageAction installAction)
		{
			foreach (PackageOperation operation in installAction.Operations) {
				Execute(operation);
			}
			AddPackageReference(package, installAction.IgnoreDependencies, installAction.AllowPrereleaseVersions);
		}
		public void InstallPackage(IPackage package, InstallPackageAction installAction)
		{
			PackagePassedToInstallPackage = package;
			PackageOperationsPassedToInstallPackage = installAction.Operations;
			IgnoreDependenciesPassedToInstallPackage = installAction.IgnoreDependencies;
			AllowPrereleaseVersionsPassedToInstallPackage = installAction.AllowPrereleaseVersions;
		}
Example #4
0
		public IEnumerable<PackageOperation> GetInstallPackageOperations(IPackage package, InstallPackageAction installAction)
		{
			PackagePassedToGetInstallPackageOperations = package;
			IgnoreDependenciesPassedToGetInstallPackageOperations = installAction.IgnoreDependencies;
			AllowPrereleaseVersionsPassedToGetInstallPackageOperations = installAction.AllowPrereleaseVersions;
			return PackageOperationsToReturnFromGetInstallPackageOperations;
		}
		void CreateAction ()
		{
			packageManagementEvents = new PackageManagementEvents ();
			fakeProject = new FakePackageManagementProject ();
			action = new InstallPackageAction (fakeProject, packageManagementEvents);
			installPackageHelper = new InstallPackageHelper (action);
		}
Example #6
0
 public void InstallPackage(IPackage package, InstallPackageAction installAction)
 {
     foreach (PackageOperation operation in installAction.Operations)
     {
         Execute(operation);
     }
     AddPackageReference(package, installAction.IgnoreDependencies, installAction.AllowPrereleaseVersions);
 }
 IPackageOperationResolver CreateInstallPackageOperationResolver(InstallPackageAction installAction)
 {
     return(packageOperationResolverFactory.CreateInstallPackageOperationResolver(
                LocalRepository,
                SourceRepository,
                Logger,
                installAction));
 }
		InstallPackageAction AddAction()
		{
			var project = new FakePackageManagementProject();
			var events = new FakePackageManagementEvents();
			var action = new InstallPackageAction(project, events);
			actions.AddAction(action);
			return action;
		}
Example #9
0
        void InstallPackage()
        {
            InstallPackageAction action = Project.CreateInstallPackageAction();

            action.Package                 = Package;
            action.OpenReadMeText          = false;
            action.IgnoreDependencies      = !UpdateDependencies;
            action.AllowPrereleaseVersions = !Package.IsReleaseVersion();
            action.Execute();
        }
        InstallPackageAction CreateInstallPackageAction(
            IPackageManagementProject project,
            PackageReference packageReference)
        {
            InstallPackageAction action = project.CreateInstallPackageAction();

            action.PackageId      = packageReference.Id;
            action.PackageVersion = packageReference.Version;
            return(action);
        }
        void GetInstallOperationsForProject()
        {
            IPackageManagementProject project = GetSingleProjectSelected();

            project.Logger = logger;
            InstallPackageAction installAction = project.CreateInstallPackageAction();

            installAction.AllowPrereleaseVersions = parent.IncludePrerelease;
            packageOperations = project.GetInstallPackageOperations(package, installAction);
        }
Example #12
0
		public void InstallPackage(IPackage package, InstallPackageAction installAction)
		{
			PackagePassedToInstallPackage = package;
			
			IgnoreDependenciesPassedToInstallPackage = installAction.IgnoreDependencies;
			PackageOperationsPassedToInstallPackage = installAction.Operations;
			AllowPrereleaseVersionsPassedToInstallPackage = installAction.AllowPrereleaseVersions;
			
			IsRefreshProjectBrowserCalledWhenInstallPackageCalled = FakeProjectService.IsRefreshProjectBrowserCalled;
		}
Example #13
0
        IEnumerable <IPackage> GetPackagesRequiringLicenseAcceptance(IPackageManagementSelectedProject selectedProject)
        {
            IPackageManagementProject project = selectedProject.Project;

            project.Logger = logger;
            InstallPackageAction installAction = project.CreateInstallPackageAction();

            installAction.AllowPrereleaseVersions = parent.IncludePrerelease;
            IEnumerable <PackageOperation> operations = project.GetInstallPackageOperations(package, installAction);

            return(GetPackagesRequiringLicenseAcceptance(operations));
        }
		public IPackageOperationResolver CreateInstallPackageOperationResolver(
			IPackageRepository localRepository,
			IPackageRepository sourceRepository,
			ILogger logger,
			InstallPackageAction installAction)
		{
			return new InstallWalker(
				localRepository,
				sourceRepository,
				logger,
				installAction.IgnoreDependencies,
				installAction.AllowPrereleaseVersions);
		}
Example #15
0
 public IPackageOperationResolver CreateInstallPackageOperationResolver(
     IPackageRepository localRepository,
     IPackageRepository sourceRepository,
     ILogger logger,
     InstallPackageAction installAction)
 {
     return(new InstallWalker(
                localRepository,
                sourceRepository,
                logger,
                installAction.IgnoreDependencies,
                installAction.AllowPrereleaseVersions));
 }
        void GetInstallOperationsForSelectedProjects(IEnumerable <IPackageManagementSelectedProject> projects)
        {
            packageOperations = new PackageOperation[0];

            IPackageManagementSelectedProject firstSelectedProject = projects.FirstOrDefault(project => project.IsSelected);

            if (firstSelectedProject != null)
            {
                InstallPackageAction installAction = firstSelectedProject.Project.CreateInstallPackageAction();
                installAction.AllowPrereleaseVersions = parent.IncludePrerelease;
                packageOperations = firstSelectedProject.Project.GetInstallPackageOperations(package, installAction);
            }
        }
        void GetInstallOperationsForSolutionPackage(
            ISolutionPackageRepository solutionRepository,
            InstallPackageAction installAction,
            IPackageFromRepository installPackage)
        {
            var resolverFactory = new PackageOperationsResolverFactory();
            var resolver        = resolverFactory.CreateInstallPackageOperationResolver(
                solutionRepository.Repository,
                installPackage.Repository,
                logger,
                installAction);

            packageOperations = resolver.ResolveOperations(installPackage);
        }
		public IPackageOperationResolver CreateInstallPackageOperationResolver(
			IPackageRepository localRepository,
			IPackageRepository sourceRepository,
			ILogger logger,
			InstallPackageAction installAction)
		{
			LocalRepositoryPassedToCreateInstallPackageOperationsResolver = localRepository;
			SourceRepositoryPassedToCreateInstallPackageOperationsResolver = sourceRepository;
			LoggerPassedToCreateInstallPackageOperationResolver = logger;
			IgnoreDependenciesPassedToCreateInstallPackageOperationResolver = installAction.IgnoreDependencies;
			AllowPrereleaseVersionsPassedToCreateInstallPackageOperationResolver = installAction.AllowPrereleaseVersions;
			
			return FakeInstallPackageOperationResolver;
		}
		public IPackageOperationResolver CreateInstallPackageOperationResolver(
			IPackageRepository localRepository,
			IPackageRepository sourceRepository,
			ILogger logger,
			InstallPackageAction installAction)
		{
			return new InstallWalker(
				localRepository,
				sourceRepository,
				installAction.ProjectTargetFramework,
				logger,
				installAction.IgnoreDependencies,
				installAction.AllowPrereleaseVersions,
				DependencyVersion.Lowest);
		}
Example #20
0
 public IPackageOperationResolver CreateInstallPackageOperationResolver(
     IPackageRepository localRepository,
     IPackageRepository sourceRepository,
     ILogger logger,
     InstallPackageAction installAction)
 {
     return(new InstallWalker(
                localRepository,
                sourceRepository,
                installAction.ProjectTargetFramework,
                logger,
                installAction.IgnoreDependencies,
                installAction.AllowPrereleaseVersions,
                DependencyVersion.Lowest));
 }
        List <InstallPackageAction> GetInstallPackageActions(
            IEnumerable <PackageReference> packageReferences,
            MSBuildBasedProject project)
        {
            var actions = new List <InstallPackageAction>();

            IPackageManagementProject packageManagementProject = CreatePackageManagementProject(project);

            foreach (PackageReference packageReference in packageReferences)
            {
                InstallPackageAction action = CreateInstallPackageAction(packageManagementProject, packageReference);
                actions.Add(action);
            }

            return(actions);
        }
        protected virtual void InstallPackageIntoSolution()
        {
            ISolutionPackageRepository solutionRepository = selectedProjects.Solution.CreateSolutionPackageRepository();
            var installAction = new InstallPackageAction(null, packageManagementEvents);

            installAction.Package                 = package;
            installAction.IgnoreDependencies      = false;
            installAction.AllowPrereleaseVersions = parent.IncludePrerelease;

            GetInstallOperationsForSolutionPackage(solutionRepository, installAction, package);

            if (LicensesAccepted())
            {
                InstallPackageIntoSolution(solutionRepository, installAction, package);
                packageManagementEvents.OnParentPackageInstalled(package);
            }
        }
        void InstallPackageIntoSolution(
            ISolutionPackageRepository solutionRepository,
            InstallPackageAction installAction,
            IPackageFromRepository installPackage)
        {
            var packageManager = new PackageManager(
                installPackage.Repository,
                solutionRepository.PackagePathResolver,
                solutionRepository.FileSystem,
                solutionRepository.Repository);

            packageManager.InstallPackage(
                installPackage.Id,
                installPackage.Version,
                installAction.IgnoreDependencies,
                installAction.AllowPrereleaseVersions);
        }
		public void ProjectTargetFramework_NullProject_ReturnsNull()
		{
			var installAction = new InstallPackageAction(null, new FakePackageManagementEvents());
			
			FrameworkName targetFramework = installAction.ProjectTargetFramework;
			
			Assert.IsNull(targetFramework);
		}
        public IEnumerable <PackageOperation> GetInstallPackageOperations(IPackage package, InstallPackageAction installAction)
        {
            IPackageOperationResolver resolver = CreateInstallPackageOperationResolver(installAction);

            return(resolver.ResolveOperations(package));
        }
		void AddInstallActionWithMissingPackageId (string packageId = "Unknown")
		{
			var action = new InstallPackageAction (new FakePackageManagementProject (), packageManagementEvents);
			action.PackageId = packageId;
			actions.Add (action);
		}
		PackageReferenceNode CreatePackageReferenceNode (InstallPackageAction installAction)
		{
			return new PackageReferenceNode (
				new PackageReference (installAction.Package.Id, installAction.Package.Version, null, null, false),
				false,
				true);
		}
		public void InstallPackage(IPackage package, InstallPackageAction installAction)
		{
			packageManager.InstallPackage(package, installAction);
		}
 public void InstallPackage(IPackage package, InstallPackageAction installAction)
 {
     RunPackageOperations(installAction.Operations);
     AddPackageReference(package, installAction.IgnoreDependencies, installAction.AllowPrereleaseVersions);
 }
Example #30
0
 public void InstallPackage(IPackage package, InstallPackageAction installAction)
 {
     packageManager.InstallPackage(package, installAction);
 }
		public IEnumerable<PackageOperation> GetInstallPackageOperations(IPackage package, InstallPackageAction installAction)
		{
			return packageManager.GetInstallPackageOperations(package, installAction);
		}
 IPackageOperationResolver CreateInstallPackageOperationResolver(InstallPackageAction installAction)
 {
     return packageOperationResolverFactory.CreateInstallPackageOperationResolver(
         LocalRepository,
         SourceRepository,
         Logger,
         installAction);
 }
		PackageReferenceNode CreatePackageReferenceNode (InstallPackageAction installAction)
		{
			return new PackageReferenceNode (
				new PackageReference (installAction.GetPackageId (), installAction.GetPackageVersion (), null, null, false),
				false,
				true);
		}
		public void InstallPackage(IPackage package, InstallPackageAction installAction)
		{
			InstallPackageAction(package, installAction);
		}
 public void InstallPackage(IPackage package, InstallPackageAction installAction)
 {
     RunPackageOperations(installAction.Operations);
     AddPackageReference(package, installAction.IgnoreDependencies, installAction.AllowPrereleaseVersions);
 }
Example #36
0
 public IEnumerable <PackageOperation> GetInstallPackageOperations(IPackage package, InstallPackageAction installAction)
 {
     return(packageManager.GetInstallPackageOperations(package, installAction));
 }
		public InstallPackageHelper (InstallPackageAction action)
		{
			this.action = action;
		}
 public IEnumerable<PackageOperation> GetInstallPackageOperations(IPackage package, InstallPackageAction installAction)
 {
     IPackageOperationResolver resolver = CreateInstallPackageOperationResolver(installAction);
     return resolver.ResolveOperations(package);
 }