示例#1
0
        public async Task AggregateAsync_IdenticalFeeds()
        {
            var indexer    = new DownloadCountResultsIndexer();
            var aggregator = new SearchResultsAggregator(indexer, new PackageSearchMetadataSplicer());

            var queryString = "nuget";

            var rawSearch1 = TestUtility.LoadTestResponse("relativeOrder1.json");
            var rawSearch2 = TestUtility.LoadTestResponse("relativeOrder1.json");

            var results = await aggregator.AggregateAsync(queryString, rawSearch1, rawSearch2);

            Assert.Equal(rawSearch1.Select(r => r.Identity), results.Select(r => r.Identity));
        }
示例#2
0
        public async Task AggregateAsync_MaintainsOrder()
        {
            var indexer    = new DownloadCountResultsIndexer();
            var aggregator = new SearchResultsAggregator(indexer, new PackageSearchMetadataSplicer());

            var queryString = "nuget";

            var rawSearch1 = TestUtility.LoadTestResponse("relativeOrder1.json");
            var rawSearch2 = TestUtility.LoadTestResponse("relativeOrder2.json");
            var rawSearch3 = TestUtility.LoadTestResponse("relativeOrder3.json");

            var results = await aggregator.AggregateAsync(queryString, rawSearch1, rawSearch2, rawSearch3);

            AssertRelativeOrder(rawSearch1, results);
            AssertRelativeOrder(rawSearch2, results);
            AssertRelativeOrder(rawSearch3, results);
        }