public SelectionsManagerTest() { _feedManagerMock = CreateMock <IFeedManager>(); _storeMock = CreateMock <IImplementationStore>(); _packageManagerMock = CreateMock <IPackageManager>(); _selectionsManager = new SelectionsManager(_feedManagerMock.Object, _storeMock.Object, _packageManagerMock.Object); }
/// <summary> /// Creates a new external JSON solver. /// </summary> /// <param name="backingSolver">An internal solver used to find an implementation of the external solver.</param> /// <param name="selectionsManager">Used to check whether the external solver is already in the cache.</param> /// <param name="fetcher">Used to download implementations of the external solver.</param> /// <param name="executor">Used to launch the external solver.</param> /// <param name="externalSolverUri">The feed URI used to get the external solver.</param> /// <param name="feedManager">Provides access to remote and local <see cref="Feed"/>s. Handles downloading, signature verification and caching.</param> /// <param name="handler">A callback object used when the the user needs to be asked questions or informed about download and IO tasks.</param> public ExternalSolver(ISolver backingSolver, ISelectionsManager selectionsManager, IFetcher fetcher, IExecutor executor, FeedUri externalSolverUri, IFeedManager feedManager, ITaskHandler handler) { _backingSolver = backingSolver ?? throw new ArgumentNullException(nameof(backingSolver)); _selectionsManager = selectionsManager ?? throw new ArgumentNullException(nameof(selectionsManager)); _fetcher = fetcher ?? throw new ArgumentNullException(nameof(fetcher)); _executor = executor ?? throw new ArgumentNullException(nameof(executor)); _feedManager = feedManager ?? throw new ArgumentNullException(nameof(feedManager)); _handler = handler ?? throw new ArgumentNullException(nameof(handler)); _solverRequirements = new Requirements(externalSolverUri ?? throw new ArgumentNullException(nameof(externalSolverUri))); }
/// <summary> /// Combines <see cref="ISelectionsManager.GetUncachedSelections"/> and <see cref="ISelectionsManager.GetImplementations"/>. /// </summary> /// <param name="selectionsManager">The <see cref="ISelectionsManager"/></param> /// <param name="selections">The selections to search for <see cref="ImplementationSelection"/>s that are missing.</param> public static ICollection <Implementation> GetUncachedImplementations([NotNull] this ISelectionsManager selectionsManager, [NotNull] Selections selections) { #region Sanity checks if (selectionsManager == null) { throw new ArgumentNullException(nameof(selectionsManager)); } if (selections == null) { throw new ArgumentNullException(nameof(selections)); } #endregion return(selectionsManager.GetImplementations(selectionsManager.GetUncachedSelections(selections)).ToList()); }
/// <summary> /// Creates a new external JSON solver. /// </summary> /// <param name="backingSolver">An internal solver used to find an implementation of the external solver.</param> /// <param name="selectionsManager">Used to check whether the external solver is already in the cache.</param> /// <param name="fetcher">Used to download implementations of the external solver.</param> /// <param name="executor">Used to launch the external solver.</param> /// <param name="config">User settings controlling network behaviour, solving, etc.</param> /// <param name="feedManager">Provides access to remote and local <see cref="Feed"/>s. Handles downloading, signature verification and caching.</param> /// <param name="handler">A callback object used when the the user needs to be asked questions or informed about download and IO tasks.</param> public ExternalSolver([NotNull] ISolver backingSolver, [NotNull] ISelectionsManager selectionsManager, [NotNull] IFetcher fetcher, [NotNull] IExecutor executor, [NotNull] Config config, [NotNull] IFeedManager feedManager, [NotNull] ITaskHandler handler) { #region Sanity checks if (backingSolver == null) { throw new ArgumentNullException(nameof(backingSolver)); } if (selectionsManager == null) { throw new ArgumentNullException(nameof(selectionsManager)); } if (fetcher == null) { throw new ArgumentNullException(nameof(fetcher)); } if (executor == null) { throw new ArgumentNullException(nameof(executor)); } if (config == null) { throw new ArgumentNullException(nameof(config)); } if (feedManager == null) { throw new ArgumentNullException(nameof(feedManager)); } if (handler == null) { throw new ArgumentNullException(nameof(handler)); } #endregion _backingSolver = backingSolver; _selectionsManager = selectionsManager; _fetcher = fetcher; _executor = executor; _feedManager = feedManager; _handler = handler; _solverRequirements = new Requirements(config.ExternalSolverUri); }
/// <summary> /// Creates a new external JSON solver. /// </summary> /// <param name="backingSolver">An internal solver used to find an implementation of the external solver.</param> /// <param name="selectionsManager">Used to check whether the external solver is already in the cache.</param> /// <param name="fetcher">Used to download implementations of the external solver.</param> /// <param name="executor">Used to launch the external solver.</param> /// <param name="config">User settings controlling network behaviour, solving, etc.</param> /// <param name="feedManager">Provides access to remote and local <see cref="Feed"/>s. Handles downloading, signature verification and caching.</param> /// <param name="handler">A callback object used when the the user needs to be asked questions or informed about download and IO tasks.</param> public ExternalSolver([NotNull] ISolver backingSolver, [NotNull] ISelectionsManager selectionsManager, [NotNull] IFetcher fetcher, [NotNull] IExecutor executor, [NotNull] Config config, [NotNull] IFeedManager feedManager, [NotNull] ITaskHandler handler) { #region Sanity checks if (backingSolver == null) throw new ArgumentNullException(nameof(backingSolver)); if (selectionsManager == null) throw new ArgumentNullException(nameof(selectionsManager)); if (fetcher == null) throw new ArgumentNullException(nameof(fetcher)); if (executor == null) throw new ArgumentNullException(nameof(executor)); if (config == null) throw new ArgumentNullException(nameof(config)); if (feedManager == null) throw new ArgumentNullException(nameof(feedManager)); if (handler == null) throw new ArgumentNullException(nameof(handler)); #endregion _backingSolver = backingSolver; _selectionsManager = selectionsManager; _fetcher = fetcher; _executor = executor; _feedManager = feedManager; _handler = handler; _solverRequirements = new Requirements(config.ExternalSolverUri); }