public string ResolvesUsingMultipleRepos(string id, string version, string spec, bool isLatest) { var versionSpec = spec == null ? null : VersionUtility.ParseVersionSpec(spec); //Add to appropriate cache we want to test based on whether we have a versionspec or not. var console = new Mock<ILogger>().Object; var cache = new MemoryBasedPackageCache(console); //Repository does not have these versions, so any call to it will fail... var resolver = new PackageResolutionManager(console, isLatest, cache); var remoteRepository = Utilities.GetFactory().CreateRepository("MultiAggregate"); var result = resolver.ResolveLatestInstallablePackage(remoteRepository, new PackageReference(id, SemanticVersion.Parse(version), versionSpec, null, false)); //Null result when we call ResolveLastestInstallablePackage when PackageResolutionManager not using Latest return result == null ? "" : result.Version.ToString(); }
public string ResolvesFromCacheFirst(string id, string version, string spec, string cacheVersion, bool isLatest) { //Setup the package and versionspec for the cache var cachePackage = new DataServicePackage() { Id = id, Version = cacheVersion }; var versionSpec = spec == null ? null : VersionUtility.ParseVersionSpec(spec); //Add to appropriate cache we want to test based on whether we have a versionspec or not. var console = new Mock<ILogger>().Object; var cache = new MemoryBasedPackageCache(console); if (versionSpec == null) cache.AddCacheEntryByIsLatest(cachePackage); else cache.AddCacheEntryByConstraint(cachePackage, versionSpec); //Repository does not have these versions, so any call to it will fail... var resolver = new PackageResolutionManager(console, isLatest, cache); var remoteRepository = Utilities.GetFactory().CreateRepository("SingleAggregate"); var result = resolver.ResolveLatestInstallablePackage(remoteRepository, new PackageReference(id, SemanticVersion.Parse(version), versionSpec, null, false)); //Null result when we call ResolveLastestInstallablePackage when PackageResolutionManager not using Latest return result == null ? "" : result.Version.ToString(); }