public void ShouldExtractFromTitleTag() { var htmlContent = string.Format(TitleTagTemplate, "my title"); var htmlDocument = TestUtilites.CreateHtmlDocument(htmlContent); var context = new ExtractorContext(htmlDocument); var extractor = new TitleExtractor(); extractor.Execute(context); context.Title.Should().Be("my title"); }
public void ShouldExtractFromOpenGraph(string title, string expectedTitle) { var htmlDocument = TestUtilites.CreateHtmlDocument("<html></hmtl>"); var context = new ExtractorContext(htmlDocument) { OpenGraph = new Dictionary <string, string>() { { "title", title }, { "site_name", "hi" } }, Domain = "www.example.com" }; var extractor = new TitleExtractor(); extractor.Execute(context); context.Title.Should().Be(expectedTitle); }