public void GetUpdatedPackages_OnePackageReferencedWithConstraintAndUpdatesAvailable_LatestVersionReturnedBasedOnConstraint() { CreateProject(); project.FakePackages.Add(new FakePackage("Test", "1.0")); var sourceRepository = new FakePackageRepository(); FakePackage packageVersion2 = sourceRepository.AddFakePackageWithVersion("Test", "2.0"); FakePackage [] expectedPackages = new [] { packageVersion2 }; sourceRepository.AddFakePackageWithVersion("Test", "3.0"); var versionSpec = new VersionSpec(); versionSpec.MinVersion = new SemanticVersion("1.0"); versionSpec.IsMinInclusive = true; versionSpec.MaxVersion = new SemanticVersion("2.0"); versionSpec.IsMaxInclusive = true; var constraintProvider = new DefaultConstraintProvider(); constraintProvider.AddConstraint("Test", versionSpec); project.ConstraintProvider = constraintProvider; CreateUpdatedPackages(sourceRepository); IEnumerable <IPackage> packages = updatedPackages.GetUpdatedPackages(); PackageCollectionAssert.AreEqual(expectedPackages, packages); }
public void ProcessRecord_ListAvailableWithFilterAndOnlineRepositoryHasPrereleasePackages_ReturnsNoPrereleasePackages() { CreateCmdlet(); FakePackageRepository repository = fakeRegisteredPackageRepositories.FakePackageRepository; FakePackage expectedPackage = repository.AddFakePackageWithVersion("B", "2.1.0"); FakePackage package = repository.AddFakePackageWithVersion("B", "2.1.0-beta"); EnableListAvailableParameter(); SetFilterParameter("B"); RunCmdlet(); List <object> actualPackages = fakeCommandRuntime.ObjectsPassedToWriteObject; var expectedPackages = new FakePackage[] { expectedPackage }; CollectionAssert.AreEqual(expectedPackages, actualPackages); }
public void CreateAggregatePriorityRepository_NoAggregatePackageSources_ReturnsPriorityPackageRepositoryThatUsesMachineCache() { CreateCache(); machineCache.AddFakePackageWithVersion("MyPackage", "1.0"); IPackageRepository repository = cache.CreateAggregateWithPriorityMachineCacheRepository(); bool exists = repository.Exists("MyPackage", new SemanticVersion("1.0")); Assert.IsInstanceOf <PriorityPackageRepository> (repository); Assert.IsTrue(exists); }
public void UpdatePackage_OldPackageReferenceIsRemovedOnUpdating_OldPackageIsUninstalled() { CreatePackageManager(); var fakeProjectManager = MockRepository.GenerateStub <ISharpDevelopProjectManager>(); packageManager.ProjectManager = fakeProjectManager; FakePackage installedPackage = fakeSolutionSharedRepository.AddFakePackageWithVersion("MyPackage", "1.0"); FakePackage updatedPackage = fakeFeedSourceRepository.AddFakePackageWithVersion("MyPackage", "1.1"); var eventArgs = new PackageOperationEventArgs(installedPackage, null, null); RaisePackageRemovedEventWhenPackageReferenceUpdated(fakeProjectManager, updatedPackage, eventArgs); var updateAction = new FakeUpdatePackageAction { Operations = new List <PackageOperation>(), UpdateDependencies = false }; packageManager.UpdatePackage(updatedPackage, updateAction); Assert.IsFalse(fakeSolutionSharedRepository.FakePackages.Contains(installedPackage)); }