Пример #1
0
        public void ShouldReturnBothPackagesWhenNeitherExistOnFeed()
        {
            const string packageId = "Package";
            var packages = new[] { new Package { Id = packageId, Version = "1.5.35" }, new Package { Id = packageId, Version = "5.88.8" } };
            var publishedPackages = new PublishedPackage[0];
            _mockedPackageRepository.SetupGet(pr => pr.Collection).Returns(packages.AsQueryable());
            _mockedPublishedPackageRepository.SetupGet(ppr => ppr.Collection).Returns(publishedPackages.AsQueryable());

            IEnumerable<Package> unfinishedPackages = _unfinishedPackageGetter.GetUnfinishedPackages(Guid.NewGuid().ToString(), new[] { packageId });

            Assert.AreEqual(2, unfinishedPackages.Count(), "Only one Package should have been returned.");
            CollectionAssert.AreEquivalent(packages, unfinishedPackages, "Expected Packages were not returned.");
        }
Пример #2
0
        public void ShouldReturnEmptyListWhenRequestIdsMatchNoExistingUnfinishedPackages()
        {
            var packages = new[] { new Package { Id = "Package", Version = "1.5.35" }, new Package { Id = "AnotherPackage", Version = "5.88.8" } };
            var publishedPackages = new PublishedPackage[0];
            _mockedPackageRepository.SetupGet(pr => pr.Collection).Returns(packages.AsQueryable());
            _mockedPublishedPackageRepository.SetupGet(ppr => ppr.Collection).Returns(publishedPackages.AsQueryable());

            var unfinishedPackages = _unfinishedPackageGetter.GetUnfinishedPackages(Guid.NewGuid().ToString(), new[] { "Foo", "Bar"});

            CollectionAssert.IsEmpty(unfinishedPackages, "No packages should have been returned.");
        }