public void FindPackagesDistinct()
        {
            var copyOfPackage1 = new PackageSpec(package1.Id, package1.Version.ToString());

            mirror.Setup(r => r.FindPackagesById("FuTools")).Returns(new[] { package1 }).Verifiable();
            origin.Setup(r => r.FindPackagesById("FuTools")).Returns(new[] { copyOfPackage1, package2 }).Verifiable();

            var result = repo.FindPackagesById("FuTools");

            mirror.VerifyAll();
            origin.VerifyAll();

            Assert.That(result.ToList(), Is.EqualTo(new[] { package1, package2 }));
        }
Example #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);
        }