public void CanSortWhenListIsEmpty() { var items = new List <PackageUpdateSet>(); var output = PackageUpdateSort.Sort(items) .ToList(); Assert.That(output, Is.Not.Null); }
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)); }
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])); }
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)); }
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)); }
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")); }
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")); }
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")); }
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)); }