public void TestBadDescriptionKeywords() { foreach (string HtmlDocKey in this.HtmlDocsBadDescription.Keys) { bool Passes = false; MacroscopeDocument msDoc = new MacroscopeDocument(Url: "https://nazuke.github.io/"); string Html = this.HtmlDocsBadDescription[HtmlDocKey]; HtmlDocument HtmlDoc = new HtmlDocument(); msDoc.SetDocumentType(Type: MacroscopeConstants.DocumentType.HTML); HtmlDoc.LoadHtml(html: Html); List <string> CleanedText = msDoc.GetNodeText(Node: HtmlDoc.DocumentNode); string Keywords = HtmlDoc.DocumentNode.SelectSingleNode("//meta[@name='keywords']").GetAttributeValue(name: "content", def: ""); string DescriptionText = HtmlDoc.DocumentNode.SelectSingleNode("//meta[@name='description']").GetAttributeValue(name: "content", def: ""); string BodyText = string.Join(" ", CleanedText.ToArray()); Assert.IsNotEmpty(Keywords, "Keywords is empty"); msDoc.SetKeywords(Keywords); msDoc.SetDescription(DescriptionText: DescriptionText, ProcessingMode: MacroscopeConstants.TextProcessingMode.DECODE_HTML_ENTITIES); msDoc.SetDocumentText(Text: BodyText); MacroscopeKeywordPresenceAnalysis Analyzer = new MacroscopeKeywordPresenceAnalysis(); List <KeyValuePair <string, MacroscopeKeywordPresenceAnalysis.KEYWORD_STATUS> > KeywordPresence = Analyzer.AnalyzeKeywordPresence(msDoc: msDoc); foreach (KeyValuePair <string, MacroscopeKeywordPresenceAnalysis.KEYWORD_STATUS> Pair in KeywordPresence) { if (Pair.Value == MacroscopeKeywordPresenceAnalysis.KEYWORD_STATUS.MISSING_IN_DESCRIPTION) { Passes = true; } } Assert.IsTrue(Passes); } }