Esempio n. 1
0
        public void ThatShapeIsAssociatedWithPackage()
        {
            var package = PackageServices.WithDto(GetPackageDto()).Get();
            var shape   = ShapeServices.WithDto(ShapeTestFixtures.GetValidDtoWithPackages()).Get();

            Assert.AreEqual(shape.PackageSet.Single(p => p.Name == package.Name), package);
        }
        public void ThatPackageWithTwoShapesCanBeDeletedLeavesTwoShapes()
        {
            var package = GetPackageWithTwoShapes();

            PackageServices.Delete(package);
            Assert.AreEqual(2, ShapeServices.Shapes.Count());
        }
Esempio n. 3
0
            public bool TryInstallPackage(Workspace workspace, DocumentId documentId, string source, string packageName, string versionOpt, bool includePrerelease, CancellationToken cancellationToken)
            {
                try {
                    var monoProject = ((MonoDevelopWorkspace)workspace).GetMonoProject(documentId.ProjectId);

                    if (!PackageServices.IsPackageInstalled(monoProject, packageName))
                    {
                        if (versionOpt == null)
                        {
                            PackageServices.InstallLatestPackage(
                                source, monoProject, packageName, includePrerelease, ignoreDependencies: false);
                        }
                        else
                        {
                            PackageServices.InstallPackage(
                                source, monoProject, packageName, versionOpt, ignoreDependencies: false);
                        }
                        return(true);
                    }
                } catch (Exception e) {
                    LoggingService.LogError("Error while installing nuget package.", e);
                }

                return(false);
            }
Esempio n. 4
0
        private void AddNuGetDependencyIfMissing(Project project, string packageId, string version = null)
        {
            if (_rootPackage != null && (version == null || version.ToLower() == "latest"))
            {
                version = _rootPackage.Version;
            }

            if (TryInstallPackageFromCache(project, packageId, version))
            {
                return;
            }

            var installedPackages = PackageServices.GetInstalledPackages(project);

            version = string.IsNullOrEmpty(version) || version == "latest" ? null : version; //if empty or latest, set to null
            //Check if existing nuget reference exists
            if (installedPackages.FirstOrDefault(x => x.Id == packageId) == null)
            {
                UpdateStatusMessage("Installing " + packageId + " from NuGet...");
                Installer.InstallPackage("https://www.nuget.org/api/v2/",
                                         project,
                                         packageId,
                                         version, //Null is latest version of packageId
                                         ignoreDependencies: false);
            }
        }
        public void ThatPackageWithTwoShapesCanBeDeleted()
        {
            var package = GetPackageWithTwoShapes();

            PackageServices.Delete(package);
            Assert.IsNull(PackageServices.Packages.SingleOrDefault(x => x.Name == package.Name));
        }
        public void ThatAPackagaWithAshapeCanBeGet()
        {
            var package = GetPackageWithShape();

            Assert.IsTrue(package.ShapeSet.Any());
            PackageServices.Delete(package);
        }
        public void ThatAPackageCanBeFound()
        {
            var package = PackageServices.WithDto(PackageTestFixtures.GetAmpulDto()).Get();

            Assert.AreEqual(package,
                            PackageServices.Packages.Single(x => x.Name == package.Name));
        }
Esempio n. 8
0
        public void ThatShapePackageRelationshipIsBiDirectional()
        {
            var package = PackageServices.WithDto(GetPackageDto()).Get();
            var shape   = ShapeServices.WithDto(ShapeTestFixtures.GetValidDtoWithPackages()).Get();

            Assert.AreEqual(shape, package.ShapeSet.First());
        }
        public void ThatAPackageCanBeDeleted()
        {
            var package = GetPackageWithoutShape();

            PackageServices.Delete(package);
            Assert.IsNull(PackageServices.Packages.SingleOrDefault(p => p.Name == package.Name));
        }
        public void ThatPackageWithShapeAfterDeletePackageLeavesShape()
        {
            var package   = GetPackageWithShape();
            var shapeName = package.ShapeSet.First().Name;

            PackageServices.Delete(package);
            var shape = ShapeServices.Shapes.SingleOrDefault(x => x.Name == shapeName);

            Assert.IsNotNull(shape);
        }
Esempio n. 11
0
 public IEnumerable <Project> GetProjectsWithInstalledPackage(Solution solution, string packageName, string version)
 {
     return(PackageServices.GetProjectsWithInstalledPackage(IdeApp.ProjectOperations.CurrentSelectedSolution, packageName, version).Select(p => TypeSystemService.GetCodeAnalysisProject(p)));
 }
Esempio n. 12
0
 public ImmutableArray <string> GetInstalledVersions(string packageName)
 {
     return(PackageServices.GetInstalledVersions(packageName));
 }
        public void ThatPackageCanBeFoundByName()
        {
            var package = PackageServices.WithDto(PackageTestFixtures.GetAmpulDto()).Get();

            Assert.AreEqual(package, PackageServices.GetByName(package.Name));
        }
        private static Package GetPackageWithoutShape()
        {
            var package = PackageServices.WithDto(PackageTestFixtures.GetAmpulDto()).Get();

            return(package);
        }
Esempio n. 15
0
 public void ShowManagePackagesDialog(string packageName)
 {
     PackageServices.ShowManagePackagesDialog(packageName);
 }
 private static Package GetPackageWithShape()
 {
     return(PackageServices.WithDto(PackageTestFixtures.GetDtoWithOneShape()).Get());
 }
Esempio n. 17
0
 /// <summary>
 /// Get package sources.
 ///
 /// NOTE: This method is known to be called from the threadpool, while the UI thread is blocking.
 /// Therefore, it must be thread-safe and not defer to and then block other threads.
 /// </summary>
 public ImmutableArray <PackageSource> GetPackageSources()
 {
     return(PackageServices.GetSources(false, false).Select(kv => new PackageSource(kv.Key, kv.Value)).ToImmutableArray());
 }
 private Package GetPackageWithTwoShapes()
 {
     return(PackageServices.WithDto(PackageTestFixtures.GetDtoWithTwoShapes()).Get());
 }
Esempio n. 19
0
 public AddLineAndPackageViewModel()
 {
     LService = new LineServices();
     PService = new PackageServices();
 }