public void ReturnsConstructorParameter() { var package = StubPackageFactory.CreatePackage("A", "1.0.0"); var packageUpgrade = new PackageUpgrade(null, PackageUpgradeAction.None, package); Assert.Equal(package, packageUpgrade.Package); }
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 void ConsistsOfPackageDependencyAndAction() { PackageUpgrade packageUpgrade; var packageDependency = StubPackageDependencyFactory.CreateExact("A", "1.0.0"); var package = StubPackageFactory.CreatePackage("A", "1.2.0"); packageUpgrade = new PackageUpgrade(packageDependency, PackageUpgradeAction.MinVersion, package); Assert.Equal("A [1.0.0, 1.0.0] MinVersion -> A 1.2.0", packageUpgrade.ToString()); packageDependency = StubPackageDependencyFactory.Create("B", "1.0.0", "2.0.0"); package = StubPackageFactory.CreatePackage("B", "2.1.0-beta2"); packageUpgrade = new PackageUpgrade(packageDependency, PackageUpgradeAction.ReleaseToPrerelease, package); Assert.Equal("B [1.0.0, 2.0.0) ReleaseToPrerelease -> B 2.1.0-beta2", packageUpgrade.ToString()); }
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 IEnumerable <PackageDependencyInfo> BuildPackages() => _packageDefinitions.Select(definition => StubPackageFactory.CreatePackage(definition.Item1, definition.Item2, definition.Item3));