public void CanResolveFromLocalRepository() { var console = new Mock<ILogger>().Object; var resolver = new PackageResolutionManager(console, true, new MemoryBasedPackageCache(console)); var remoteRepository = Utilities.GetFactory().CreateRepository("SingleAggregate"); var localRepository = new MockPackageRepository(); var package = new DataServicePackage() { Id = "Assembly.Common", Version = "1.0" }; var test = resolver.FindPackageInAllLocalSources(localRepository, remoteRepository, package, false, false); Assert.AreEqual("Assembly.Common", test.Id); }
public void WillNotUseODataIfPackageLocal() { var console = new Mock<ILogger>().Object; var resolver = new PackageResolutionManager(console, true, new MemoryBasedPackageCache(console)); var odata = new Mock<DataServicePackageRepository>(new Uri(@"http://nuget.org")); var list = new List<IPackage>() { new DataServicePackage() { Id = "Assembly.Common", Version = "3.0" } }; odata.Setup(o => o.GetPackages()).Returns(list.AsQueryable()); var remoteRepository = new AggregateRepository(new List<IPackageRepository>() { Utilities.GetFactory().CreateRepository("SingleAggregate"), odata.Object }); var localRepository = new MockPackageRepository(); var package = new DataServicePackage() { Id = "Assembly.Common", Version = "3.0" }; Assert.AreEqual(true,remoteRepository.GetPackages().Contains(package)); var local = resolver.FindPackageInAllLocalSources(localRepository, remoteRepository, package, false, false); Assert.AreEqual(null, local); }