public async Task ReturnsRecentVersionOfPackage(string expected, string versions) { var packages = StubPackageFactory.CreatePackages("Package", versions.Split(';')); var repository = StubSourceRepositoryFactory.Create(packages); var recentPackages = await repository.GetRecentPackagesAsync(); Assert.Equal(expected, recentPackages.Single().Version.ToString()); }
public async Task UndiscoverablePackageOfPackageDependencyIsUnknownUpgradeAction() { var package = StubPackageFactory.CreatePackage("Exact", "1.0.0", StubPackageDependencyFactory.CreateExact("Dependency", "1.0.0")); var repository = StubSourceRepositoryFactory.Create(new[] { package, }); var walker = new UpgradeWalker(repository); var upgrades = await walker.GetPackageUpgradesAsync(package); Assert.Single(upgrades); Assert.Equal(PackageUpgradeAction.Unknown, upgrades.ElementAt(0).Action); Assert.Null(upgrades.ElementAt(0).Package); }
public async Task SatisfiedVersionSpecWithMatchingInclusiveMinVersionIsNotUpgradeable() { var package = StubPackageFactory.CreatePackage("Package", "1.0.0", StubPackageDependencyFactory.Create("Dependency", "1.0.0")); var dependency = StubPackageFactory.CreatePackage("Dependency", "1.0.0"); var repository = StubSourceRepositoryFactory.Create(new[] { package, dependency, }); var walker = new UpgradeWalker(repository); var upgrades = await walker.GetPackageUpgradesAsync(package); Assert.Single(upgrades); Assert.Equal(PackageUpgradeAction.None, upgrades.ElementAt(0).Action); Assert.Same(dependency, upgrades.ElementAt(0).Package); }
public async Task IdentifiesReleaseToRelease() { var package = StubPackageFactory.CreatePackage("Exact", "1.0.0", StubPackageDependencyFactory.CreateExact("Dependency", "1.0.0")); var dependency10 = StubPackageFactory.CreatePackage("Dependency", "1.0.0"); var dependency11 = StubPackageFactory.CreatePackage("Dependency", "1.1.0"); var repository = StubSourceRepositoryFactory.Create(new[] { package, dependency10, dependency11, }); var walker = new UpgradeWalker(repository); var upgrades = await walker.GetPackageUpgradesAsync(package); Assert.Single(upgrades); Assert.Equal(PackageUpgradeAction.ReleaseToRelease, upgrades.ElementAt(0).Action); Assert.Equal(dependency11, upgrades.ElementAt(0).Package); }
public async Task IdentifiesPrereleaseToPrerelease() { var package = StubPackageFactory.CreatePackage("Package", "1.0.0", StubPackageDependencyFactory.CreateExact("Dependency", "1.0.0-alpha")); var dependencyAlpha = StubPackageFactory.CreatePackage("Dependency", "1.0.0-alpha"); var dependencyBeta = StubPackageFactory.CreatePackage("Dependency", "1.0.0-beta"); var repository = StubSourceRepositoryFactory.Create(new[] { package, dependencyAlpha, dependencyBeta, }); var walker = new UpgradeWalker(repository); var upgrades = await walker.GetPackageUpgradesAsync(package); Assert.Single(upgrades); Assert.Equal(PackageUpgradeAction.PrereleaseToPrerelease, upgrades.ElementAt(0).Action); Assert.Equal(dependencyBeta, upgrades.ElementAt(0).Package); }
public async Task UnsatisfiedVersionSpecWithExclusiveMaxVersionIsPrerelease() { var package = StubPackageFactory.CreatePackage( "Package", "1.0.0", StubPackageDependencyFactory.Create("Dependency", null, "1.0.0", false, false)); var dependency = StubPackageFactory.CreatePackage("Dependency", "1.0.0"); var repository = StubSourceRepositoryFactory.Create(new[] { package, dependency, }); var walker = new UpgradeWalker(repository); var upgrades = await walker.GetPackageUpgradesAsync(package); Assert.Single(upgrades); Assert.Equal(PackageUpgradeAction.PrereleaseToRelease, upgrades.ElementAt(0).Action); Assert.Equal(dependency, upgrades.ElementAt(0).Package); }
public async Task ReturnsEmptyForEmptyPackageRepository() { var repository = StubSourceRepositoryFactory.Create(); Assert.Empty(await repository.GetRecentPackagesAsync()); }
public async Task ThrowsOnNull() { var walker = new UpgradeWalker(StubSourceRepositoryFactory.Create()); await Assert.ThrowsAsync <ArgumentNullException>("package", () => walker.GetPackageUpgradesAsync(null)); }