public async Task TestLoadFromUrlAsync() { var configuration = new Configuration(); var defaultHtmlContentReader = new DefaultHtmlContentReader(this.httpFactory.Object, this.cacheProvider.Object, this.proxySelector.Object, configuration); var content = await defaultHtmlContentReader.LoadFromUrlAsync("http://www.baidu.com"); Assert.AreEqual("success", content); }
public async Task TestLoadFromUrlAsyncWithCache() { var configuration = new Configuration(); var cacheProvider = new Mock <ICacheProvider>(); cacheProvider.Setup(x => x.GetContentFromCacheAsync(It.IsAny <string>())).ReturnsAsync("fromCache"); var defaultHtmlContentReader = new DefaultHtmlContentReader(this.httpFactory.Object, cacheProvider.Object, this.proxySelector.Object, configuration); var content = await defaultHtmlContentReader.LoadFromUrlAsync("http://www.baidu.com"); Assert.AreEqual("fromCache", content); }