コード例 #1
0
        public void CanSortWhenListIsEmpty()
        {
            var items = new List <PackageUpdateSet>();

            var output = PackageUpdateSort.Sort(items)
                         .ToList();

            Assert.That(output, Is.Not.Null);
        }
コード例 #2
0
        public void CanSortTwoItems()
        {
            var items = new List <PackageUpdateSet>
            {
                OnePackageUpdateSet(1),
                OnePackageUpdateSet(2)
            };

            var output = PackageUpdateSort.Sort(items)
                         .ToList();

            Assert.That(output, Is.Not.Null);
            Assert.That(output.Count, Is.EqualTo(2));
        }
コード例 #3
0
        public void CanSortOneItem()
        {
            var items = new List <PackageUpdateSet>
            {
                OnePackageUpdateSet(1)
            };

            var output = PackageUpdateSort.Sort(items)
                         .ToList();

            Assert.That(output, Is.Not.Null);
            Assert.That(output.Count, Is.EqualTo(1));
            Assert.That(output[0], Is.EqualTo(items[0]));
        }
コード例 #4
0
        public void TwoPackageVersionsIsSortedToTop()
        {
            var twoVersions = MakeTwoProjectVersions();
            var items       = new List <PackageUpdateSet>
            {
                OnePackageUpdateSet(3),
                OnePackageUpdateSet(4),
                twoVersions
            };

            var output = PackageUpdateSort.Sort(items)
                         .ToList();

            Assert.That(output, Is.Not.Null);
            Assert.That(output[0], Is.EqualTo(twoVersions));
        }
コード例 #5
0
        public void WillSortByProjectCount()
        {
            var items = new List <PackageUpdateSet>
            {
                OnePackageUpdateSet(1),
                OnePackageUpdateSet(2),
                OnePackageUpdateSet(3),
            };

            var output = PackageUpdateSort.Sort(items)
                         .ToList();

            Assert.That(output.Count, Is.EqualTo(3));
            Assert.That(output[0].CurrentPackages.Count, Is.EqualTo(3));
            Assert.That(output[1].CurrentPackages.Count, Is.EqualTo(2));
            Assert.That(output[2].CurrentPackages.Count, Is.EqualTo(1));
        }
コード例 #6
0
        public void WillSortByOldestFirstOverPatchVersionIncrement()
        {
            var items = new List <PackageUpdateSet>
            {
                PackageChange("1.2.6", "1.2.3", StandardPublishedDate),
                PackageChange("1.2.5", "1.2.3", StandardPublishedDate.AddYears(-1)),
                PackageChange("1.2.4", "1.2.3", StandardPublishedDate.AddYears(-2))
            };

            var output = PackageUpdateSort.Sort(items)
                         .ToList();

            Assert.That(output.Count, Is.EqualTo(3));
            Assert.That(SelectedVersion(output[0]), Is.EqualTo("1.2.4"));
            Assert.That(SelectedVersion(output[1]), Is.EqualTo("1.2.5"));
            Assert.That(SelectedVersion(output[2]), Is.EqualTo("1.2.6"));
        }
コード例 #7
0
        public void WillSortByGettingOutOfBetaFirst()
        {
            var items = new List <PackageUpdateSet>
            {
                PackageChange("2.0.0", "1.2.3"),
                PackageChange("1.2.4", "1.2.3-beta1"),
                PackageChange("1.3.0-pre-2", "1.2.3-beta1")
            };

            var output = PackageUpdateSort.Sort(items)
                         .ToList();

            Assert.That(output.Count, Is.EqualTo(3));
            Assert.That(SelectedVersion(output[0]), Is.EqualTo("1.2.4"));
            Assert.That(SelectedVersion(output[1]), Is.EqualTo("2.0.0"));
            Assert.That(SelectedVersion(output[2]), Is.EqualTo("1.3.0-pre-2"));
        }
コード例 #8
0
        public void WillSortByBiggestVersionChange()
        {
            var items = new List <PackageUpdateSet>
            {
                PackageChange("1.2.4", "1.2.3"),
                PackageChange("2.0.0", "1.2.3"),
                PackageChange("1.3.0", "1.2.3")
            };

            var output = PackageUpdateSort.Sort(items)
                         .ToList();

            Assert.That(output.Count, Is.EqualTo(3));
            Assert.That(SelectedVersion(output[0]), Is.EqualTo("2.0.0"));
            Assert.That(SelectedVersion(output[1]), Is.EqualTo("1.3.0"));
            Assert.That(SelectedVersion(output[2]), Is.EqualTo("1.2.4"));
        }
コード例 #9
0
        public void WillSortByProjectVersionsOverProjectCount()
        {
            var twoVersions = MakeTwoProjectVersions();
            var items       = new List <PackageUpdateSet>
            {
                OnePackageUpdateSet(10),
                OnePackageUpdateSet(20),
                twoVersions,
            };

            var output = PackageUpdateSort.Sort(items)
                         .ToList();

            Assert.That(output.Count, Is.EqualTo(3));
            Assert.That(output[0], Is.EqualTo(twoVersions));
            Assert.That(output[1].CurrentPackages.Count, Is.EqualTo(20));
            Assert.That(output[2].CurrentPackages.Count, Is.EqualTo(10));
        }