ZeroInstall.Services.Solvers.SelectionCandidateProvider.GetSortedCandidates C# (CSharp) Method

GetSortedCandidates() public method

Gets all SelectionCandidates for a specific set of Requirements sorted from best to worst.
public GetSortedCandidates ( [ requirements ) : IList
requirements [
return IList
        public IList<SelectionCandidate> GetSortedCandidates([NotNull] Requirements requirements)
        {
            var candidates = GetFeeds(requirements)
                .SelectMany(x => GetCandidates(x.Key, x.Value, requirements))
                .ToList();
            candidates.Sort(_comparer[requirements.InterfaceUri]);
            return candidates;
        }

Usage Example

Esempio n. 1
0
        public void TestGetSortedCandidates()
        {
            var mainFeed = FeedTest.CreateTestFeed();

            mainFeed.Feeds.Clear();
            _feedManagerMock.Setup(x => x[FeedTest.Test1Uri]).Returns(mainFeed);
            _packageManagerMock.Setup(x => x.Query((PackageImplementation)mainFeed.Elements[1])).Returns(Enumerable.Empty <ExternalImplementation>());

            var requirements = new Requirements(FeedTest.Test1Uri, Command.NameRun);

            _provider.GetSortedCandidates(requirements).Should().Equal(
                new SelectionCandidate(FeedTest.Test1Uri, new FeedPreferences(), (Implementation)mainFeed.Elements[0], requirements));
        }
All Usage Examples Of ZeroInstall.Services.Solvers.SelectionCandidateProvider::GetSortedCandidates