/// <summary> /// Initializes a new instance of the <see cref="JavDBExtractor"/> class. /// </summary> /// <param name="htmlContentReader">The htmlContentReader<see cref="IHtmlContentReader"/>.</param> /// <param name="cacheProvider">The cacheProvider<see cref="ICacheProvider"/>.</param> /// <param name="configuration">The configuration<see cref="Configuration"/>.</param> public JavDBExtractor(IHtmlContentReader htmlContentReader, ICacheProvider cacheProvider, AVLib.Configuration configuration) { this.htmlContentReader = htmlContentReader; this.cacheProvider = cacheProvider; this.conf = configuration; this.baseUrl = configuration.GetBaseUrl(GetKey()); this.context = BrowsingContext.New(Configuration.Default); }
public void Init() { Mock <IHtmlContentReader> mock = new Mock <IHtmlContentReader>(); var searchContent = File.ReadAllText(Path.Combine(Directory.GetCurrentDirectory(), "Test", "JAVDB", "SearchIndex.html")); var detailContent = File.ReadAllText(Path.Combine(Directory.GetCurrentDirectory(), "Test", "JAVDB", "detail.html")); mock.Setup(x => x.LoadFromUrlAsync(It.Is <string>(x => x.Equals("https://javdb4.com/search?q=MUM-120&f=all")))).ReturnsAsync(searchContent); mock.Setup(x => x.LoadFromUrlAsync(It.Is <string>(x => x.Equals("https://javdb4.com/v/8VvnW?locale=zh")))).ReturnsAsync(detailContent); this.htmlContentReader = mock.Object; this.configuration = new Configuration(); this.cacheProvider = new DictCacheProvider(); }