public qbittorrentSettingBuilder() { _mockQbittorrentSetting = new Mock <IOptionsSnapshot <QbittorrentSettings> >(); QbittorrentSettings setting = new QbittorrentSettings() { WebUrl = "http://127.0.0.1:6882/", Username = "******", Password = "******", MaxDownloadCount = 3, DownloadRootPath = @"E:\TEST\JavDownload", Category = "jav" }; _mockQbittorrentSetting.Setup(ap => ap.Value).Returns(setting); }
public void TestGetTorrentInfoFromRemoteUrl() { var mockQbittorrentSetting = new Mock <IOptionsSnapshot <QbittorrentSettings> >(); QbittorrentSettings setting = new QbittorrentSettings() { WebUrl = "http://192.168.1.22:8080/", Username = "******", Password = "******", }; mockQbittorrentSetting.Setup(ap => ap.Value).Returns(setting); var qbittorrentService = new QbittorrentService(_logger, mockQbittorrentSetting.Object); var hash = "7e8ec6418a9cc070de668a9e13649a97d10e5611"; var torrentInfo = qbittorrentService.GetTorrentInfo(hash); }
public QbittorrentService(IAppLogger <QbittorrentService> logger, IOptionsSnapshot <QbittorrentSettings> qbittorrentSetting) { _logger = logger; _qbittorrentSetting = qbittorrentSetting.Value; _client = new QBittorrentClient(new Uri(_qbittorrentSetting.WebUrl)); }