public HttpExtractor( [Inject("default-agents")] IUserAgentPool userAgentPool, [Inject("CoreStorage")] IStorage storage) { UserAgentPool = userAgentPool; Storage = storage; }
public HttpExtractorTests() { userAgentPool = Mock.Of <IUserAgentPool>(); Mock.Get(userAgentPool) .Setup(x => x.GetUserAgent("Chrome_1")).Returns(new ScrapyCore.Core.UserAgents.UserAgent() { AgentString = "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/22.0.1207.1 Safari/537.1" }); storage = StorageFactory.Factory.GetLocalStorage(ConstVariable.ApplicationPath); var httpSourceDemoString = storage.GetString("MockData/Fundamental/Extract/httpsourcedemo.json"); ScrapySource scrapySource = JsonConvert.DeserializeObject <ScrapySource>(httpSourceDemoString); this.parameter = scrapySource.Source.Parameters.ToString(); this.path = "httpExtractorFile.txt"; }