示例#1
0
            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());
            }
示例#2
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);
            }
示例#3
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);
            }
示例#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);
            }
示例#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);
            }
示例#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);
            }
示例#7
0
            public async Task ReturnsEmptyForEmptyPackageRepository()
            {
                var repository = StubSourceRepositoryFactory.Create();

                Assert.Empty(await repository.GetRecentPackagesAsync());
            }
示例#8
0
 public async Task ThrowsOnNull()
 {
     var walker = new UpgradeWalker(StubSourceRepositoryFactory.Create());
     await Assert.ThrowsAsync <ArgumentNullException>("package", () => walker.GetPackageUpgradesAsync(null));
 }