public GetSortedCandidates ( [ requirements ) : IList |
||
requirements | [ | |
리턴 | IList |
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)); }
/// <summary> /// Try to satisfy a set of <paramref name="requirements"/>, respecting any existing <see cref="Selections"/>. /// </summary> private bool TryToSolve([NotNull] Requirements requirements) { _cancellationToken.ThrowIfCancellationRequested(); var allCandidates = _candidateProvider.GetSortedCandidates(requirements); var suitableCandidates = FilterSuitableCandidates(allCandidates, requirements.InterfaceUri); var existingSelection = Selections.GetImplementation(requirements.InterfaceUri); if (existingSelection == null) { return(TryToSelectCandidate(suitableCandidates, requirements, allCandidates)); } else if (TryToUseExistingCandidate(requirements, suitableCandidates, existingSelection)) { return(true); } else { throw new SolverException("Dependency graph too complex"); } }