public void SetUp() { mirror = new Mock<IPackageLookup>(); origin = new Mock<IPackageLookup>(); repo = new MirroringPackageRepository(mirror.Object, origin.Object); package1 = new DataServicePackage { Id = "FuTools", Version = "1.0" }; package2 = new DataServicePackage {Id = "FuTools", Version = "2.0"}; }
public void SetUp() { mirror = new Mock<IPackageLookup>(); origin = new Mock<IPackageLookup>(); cache = new Mock<ICache>(); repo = new MirroringPackageRepository(mirror.Object, origin.Object, cache.Object); package1 = new LucenePackage(_ => null) { Id = "FuTools", Version = new StrictSemanticVersion("1.0"), IsMirrored = true }; package2 = new LucenePackage(_ => null) { Id = "FuTools", Version = new StrictSemanticVersion("2.0") }; }
public void FindPackagesAlwaysGoesToOriginIfOverideToAlwaysCheckOrigin() { repo = new EagerMirroringPackageRepository(mirror.Object, new[] { origin1.Object }, cache.Object); mirror.Setup(r => r.FindPackagesById("FuTools")).Returns(new[] { package1, package2 }).Verifiable(); origin1.Setup(r => r.FindPackagesById("FuTools")).Returns(new[] { package3 }).Verifiable(); var result = repo.FindPackagesById("FuTools"); mirror.VerifyAll(); Assert.That(result.ToList(), Is.EqualTo(new[] { package1, package2, package3 })); origin1.Verify(r => r.FindPackagesById("FuTools"), Times.Once); }