public void GetLabel_PackageReferenceIsInstalled_ReturnsPackageId()
        {
            CreatePackageReference(packageId: "MyPackage");
            CreatePackageReferenceNode();

            string label = node.GetLabel();

            Assert.AreEqual("MyPackage", label);
        }
        public void GetLabel_PackageReferenceIsInstalled_ReturnsPackageId()
        {
            CreatePackageReference(packageId: "MyPackage");
            CreatePackageReferenceNode();

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

            Assert.AreEqual("MyPackage", label);
            Assert.AreEqual("(1.2.3)", secondaryLabel);
            Assert.AreEqual(IconId.Null, node.GetStatusIconId());
        }
        public void GetPackageReferencesNodes_OnePackageReferenceButPackageNotInstalledAndNoUpdatedPackages_ReturnsOneNode()
        {
            CreateNode();
            AddPackageReferenceToProject("MyPackage", "1.0");
            NoUpdatedPackages();

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

            PackageReferenceNode referenceNode = nodes.FirstOrDefault();

            Assert.AreEqual(1, nodes.Count);
            Assert.IsFalse(referenceNode.Installed);
            Assert.AreEqual("MyPackage", referenceNode.GetLabel());
        }
        public void GetPackageReferencesNodes_OnePackageReferenceWithUpdatedPackagesButPackageNotRestored_ReturnsOneNodeWithUpdatedVersionInformationInLabel()
        {
            CreateNode();
            AddPackageReferenceToProject("MyPackage", "1.0");
            AddUpdatedPackageForProject("MyPackage", "1.2");

            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 <span color='grey'>(1.2 available)</span>", referenceNode.GetLabel());
            Assert.AreEqual(Stock.Reference, referenceNode.GetIconId());
            Assert.IsTrue(referenceNode.IsDisabled());
        }
        public void GetPackageReferencesNodes_OnePackageReferenceWithUpdatedPackages_ReturnsOneNodeWithUpdatedVersionInformationInLabel()
        {
            CreateNode();
            PackageReference packageReference = AddPackageReferenceToProject("MyPackage", "1.0");

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

            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 <span color='grey'>(1.2 available)</span>", referenceNode.GetLabel());
        }
Exemple #6
0
        public async Task GetPackageReferencesNodes_OnePackageReferenceButNoUpdatedPackages_ReturnsOneNode()
        {
            CreateNode();
            PackageReference packageReference = AddPackageReferenceToProject("MyPackage", "1.0");

            PackageIsInstalledInProject(packageReference);
            NoUpdatedPackages();
            await RefreshNodePackages();

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

            PackageReferenceNode referenceNode = nodes.FirstOrDefault();

            Assert.AreEqual(1, nodes.Count);
            Assert.IsTrue(referenceNode.Installed);
            Assert.AreEqual("MyPackage", referenceNode.GetLabel());
            Assert.AreEqual(String.Empty, packagesFolderNode.GetSecondaryLabel());
        }
Exemple #7
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.2 available)", referenceNode.GetSecondaryLabel());
        }
Exemple #8
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());
        }