public void ReturnsConstructorParameter()
            {
                var packageDependency = StubPackageDependencyFactory.CreateExact("A", "1.0.0");
                var packageUpgrade    = new PackageUpgrade(packageDependency, PackageUpgradeAction.None, null);

                Assert.Same(packageDependency, packageUpgrade.PackageDependency);
            }
Пример #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 IdentifiesPrereleaseToRelease()
            {
                var package = StubPackageFactory.CreatePackage("Exact", "1.0.0", StubPackageDependencyFactory.CreateExact("Dependency", "1.0.0-alpha"));
                var dependencyPrerelease = StubPackageFactory.CreatePackage("Dependency", "1.0.0-alpha");
                var dependencyRelease    = StubPackageFactory.CreatePackage("Dependency", "1.0.0");
                var repository           = StubSourceRepositoryFactory.Create(new[] { package, dependencyPrerelease, dependencyRelease, });
                var walker = new UpgradeWalker(repository);

                var upgrades = await walker.GetPackageUpgradesAsync(package);

                Assert.Single(upgrades);
                Assert.Equal(PackageUpgradeAction.PrereleaseToRelease, upgrades.ElementAt(0).Action);
                Assert.Equal(dependencyRelease, 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());
            }
Пример #5
0
            public async Task SatisfiedVersionSpecWithExclusiveMinVersionIsUpgradeable()
            {
                var package = StubPackageFactory.CreatePackage(
                    "Package",
                    "1.0.0",
                    StubPackageDependencyFactory.Create("Dependency", "1.0.0", null, false, false));
                var dependency = StubPackageFactory.CreatePackage("Dependency", "1.0.1-a");
                var repository = StubSourceRepositoryFactory.Create(new[] { package, dependency, });
                var walker     = new UpgradeWalker(repository);

                var upgrades = await walker.GetPackageUpgradesAsync(package);

                Assert.Single(upgrades);
                Assert.Equal(PackageUpgradeAction.MinVersion, upgrades.ElementAt(0).Action);
                Assert.Equal(dependency, upgrades.ElementAt(0).Package);
            }