public EmailController(NewsletterCuratorContext newsletterCuratorContext, HTMLScraperService htmlScraperService, EmailService.EmailService emailService, IConfiguration configuration, IHttpClientFactory clientFactory) { this.newsletterCuratorContext = newsletterCuratorContext; this.htmlScraperService = htmlScraperService; this.emailService = emailService; this.configuration = configuration; this.clientFactory = clientFactory; }
public async Task ScrapeCdemiBlog() { var scraperService = new HTMLScraperService(httpClientFactory, new NullLogger <HTMLScraperService>()); var urlMetaData = await scraperService.ScrapeMetadataAsync(new Uri("https://blog.cdemi.io/whats-coming-in-c-8-0-nullable-reference-types/?src=NewsletterCuratorTest")); Assert.AreEqual(urlMetaData.CanonicalURL, "https://blog.cdemi.io/whats-coming-in-c-8-0-nullable-reference-types/"); Assert.AreEqual(urlMetaData.Images.Count, 2); Assert.AreEqual(urlMetaData.Summary, "One of the features being discussed for introduction in C# 8.0 is Nullable Reference Types. A proficient C# Developer might say \"What?! Aren't all reference types nullable?\" "); Assert.AreEqual(urlMetaData.Title, "What's Coming in C# 8.0? Nullable Reference Types"); StringAssert.StartsWith(urlMetaData.FaviconURL, "https://blog.cdemi.io/assets/img/favicons/favicon-32x32.png"); CollectionAssert.Contains(urlMetaData.Tags, "C# 8.0"); CollectionAssert.Contains(urlMetaData.Tags, "C#"); CollectionAssert.Contains(urlMetaData.Tags, "Software Development"); CollectionAssert.Contains(urlMetaData.Tags, ".NET"); }
public NewsitemController(NewsletterCuratorContext newsletterCuratorContext, HTMLScraperService htmlScraperService, YouTubeMetadataService youTubeMetadataService) { this.newsletterCuratorContext = newsletterCuratorContext; this.htmlScraperService = htmlScraperService; this.youTubeMetadataService = youTubeMetadataService; }