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);
            }
            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 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 ThrowsOnNull()
 {
     var walker = new UpgradeWalker(StubPackageRepositoryFactory.Create(Enumerable.Empty<IPackage>()));
     Assert.Throws<ArgumentNullException>("package", () => walker.GetPackageUpgrades(null));
 }
            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);
            }