示例#1
0
        public static void TestClassInit(TestContext tc)
        {
            httpClientMock = new Mock <IHttpHandler>();
            httpClientMock.Setup(h => h.GetUrlContentAsync(testUrl)).ReturnsAsync(
                input
                );

            processor = new ProcessorWorker(httpClientMock.Object);
        }
示例#2
0
        public async Task <IActionResult> Get(string id)
        {
            using (var worker = new ProcessorWorker(httpHandler))
            {
                Website website = await repository[id];
                if (website == null)
                {
                    return(NotFound());
                }

                string websiteContent = await worker.GetWebsiteContent(website, ContentProcessor);

                worker.PopulateIndex(indexRepository.Index, websiteContent, website);
                await repository.UpdateWebsite(website);

                await indexRepository.UpdateRepo();

                return(Ok());
            }
        }