Example #1
0
            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);
            }
Example #2
0
            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 void 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 = StubPackageRepositoryFactory.Create(new[] { dependency, });
                var walker = new UpgradeWalker(repository);

                var upgrades = walker.GetPackageUpgrades(package);

                Assert.Equal(1, upgrades.Count());
                Assert.Equal(PackageUpgradeAction.None, upgrades.ElementAt(0).Action);
                Assert.Same(dependency, upgrades.ElementAt(0).Package);
            }
Example #4
0
            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);
            }
Example #5
0
            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);
            }
Example #6
0
            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);
            }
Example #7
0
 public async Task ThrowsOnNull()
 {
     var walker = new UpgradeWalker(StubSourceRepositoryFactory.Create());
     await Assert.ThrowsAsync <ArgumentNullException>("package", () => walker.GetPackageUpgradesAsync(null));
 }
            public void IdentifiesReleaseToPrerelease()
            {
                var package = StubPackageFactory.CreatePackage("Exact", "1.0.0", StubPackageDependencyFactory.CreateExact("Dependency", "1.0.0"));
                var dependencyRelease = StubPackageFactory.CreatePackage("Dependency", "1.0.0");
                var dependencyPrerelease = StubPackageFactory.CreatePackage("Dependency", "1.1.0-pre");
                var repository = StubPackageRepositoryFactory.Create(new[] { dependencyRelease, dependencyPrerelease, });
                var walker = new UpgradeWalker(repository);

                var upgrades = walker.GetPackageUpgrades(package);

                Assert.Equal(1, upgrades.Count());
                Assert.Equal(PackageUpgradeAction.ReleaseToPrerelease, upgrades.ElementAt(0).Action);
                Assert.Equal(dependencyPrerelease, upgrades.ElementAt(0).Package);
            }
 public void ThrowsOnNull()
 {
     var walker = new UpgradeWalker(StubPackageRepositoryFactory.Create(Enumerable.Empty<IPackage>()));
     Assert.Throws<ArgumentNullException>("package", () => walker.GetPackageUpgrades(null));
 }
            public void UndiscoverablePackageOfPackageDependencyIsUnknownUpgradeAction()
            {
                var package = StubPackageFactory.CreatePackage("Exact", "1.0.0", StubPackageDependencyFactory.CreateExact("Dependency", "1.0.0"));
                var repository = StubPackageRepositoryFactory.Create(Enumerable.Empty<IPackage>());
                var walker = new UpgradeWalker(repository);

                var upgrades = walker.GetPackageUpgrades(package);

                Assert.Equal(1, upgrades.Count());
                Assert.Equal(PackageUpgradeAction.Unknown, upgrades.ElementAt(0).Action);
                Assert.Null(upgrades.ElementAt(0).Package);
            }
            public void 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 = StubPackageRepositoryFactory.Create(new[] { dependency, });
                var walker = new UpgradeWalker(repository);

                var upgrades = walker.GetPackageUpgrades(package);

                Assert.Equal(1, upgrades.Count());
                Assert.Equal(PackageUpgradeAction.PrereleaseToRelease, upgrades.ElementAt(0).Action);
                Assert.Equal(dependency, upgrades.ElementAt(0).Package);
            }