Exemplo n.º 1
0
        public void GetStatusMessage_PackageReferenceIsInstalled_ReturnsNull()
        {
            CreatePackageReference();
            CreatePackageReferenceNode();

            string message = node.GetStatusMessage();

            Assert.IsNull(message);
        }
        public void GetLabel_PackageReferenceNeedsReinstallationButHasUpdate_DoesNotShowUpdateInformation()
        {
            CreatePackageReference(
                packageId: "MyPackage",
                packageVersion: "1.0.2",
                requireReinstallation: true);
            CreatePackageReferenceNode(
                installed: true,
                updatedPackage: new PackageIdentity("MyPackage", new NuGetVersion("1.2.3.4")));

            string label          = node.GetLabel();
            string secondaryLabel = node.GetSecondaryLabel();

            Assert.AreEqual("MyPackage", label);
            Assert.AreEqual("(1.0.2)", secondaryLabel);
            Assert.AreEqual(TaskSeverity.Warning, node.GetStatusSeverity());
            Assert.AreEqual("Package needs retargeting", node.GetStatusMessage());
            Assert.AreEqual(IconId.Null, node.GetStatusIconId());
        }
Exemplo n.º 3
0
        public async Task GetPackageReferencesNodes_OnePackageReferenceWithUpdatedPackages_ReturnsOneNodeWithUpdatedVersionInformationInLabel()
        {
            CreateNode();
            PackageReference packageReference = AddPackageReferenceToProject("MyPackage", "1.0");

            PackageIsInstalledInProject(packageReference);
            AddUpdatedPackageForProject("MyPackage", "1.2");
            await RefreshNodePackages();

            List <PackageReferenceNode> nodes = packagesFolderNode.GetPackageReferencesNodes().ToList();

            PackageReferenceNode referenceNode = nodes.FirstOrDefault();

            Assert.AreEqual(1, nodes.Count);
            Assert.AreEqual("1.2", referenceNode.UpdatedVersion.ToString());
            Assert.AreEqual("MyPackage", referenceNode.GetLabel());
            Assert.AreEqual("(1.0)", referenceNode.GetSecondaryLabel());
            Assert.AreEqual("1.2 available", referenceNode.GetStatusMessage());
            Assert.AreEqual("md-package-update", referenceNode.GetStatusIconId().Name);
        }
Exemplo n.º 4
0
        public async Task GetPackageReferencesNodes_OnePackageReferenceWithUpdatedPackagesButPackageNotRestored_ReturnsOneNodeWithUpdatedVersionInformationInMenu()
        {
            CreateNode();
            AddPackageReferenceToProject("MyPackage", "1.0");
            AddUpdatedPackageForProject("MyPackage", "1.2");
            await RefreshNodePackages();

            List <PackageReferenceNode> nodes = packagesFolderNode.GetPackageReferencesNodes().ToList();

            PackageReferenceNode referenceNode = nodes.FirstOrDefault();

            Assert.AreEqual(1, nodes.Count);
            Assert.AreEqual("1.2", referenceNode.UpdatedVersion.ToString());
            Assert.AreEqual("MyPackage", referenceNode.GetLabel());
            Assert.AreEqual("(1.0)", referenceNode.GetSecondaryLabel());
            Assert.AreEqual(Stock.Reference, referenceNode.GetIconId());
            Assert.IsTrue(referenceNode.IsDisabled());
            Assert.AreEqual("Package is not restored", referenceNode.GetStatusMessage());
            Assert.AreEqual("Update to 1.2", referenceNode.GetUpdateLabel());
            Assert.AreEqual(IconId.Null, referenceNode.GetStatusIconId());
        }