< Summary

Information
Class: GistBackend.Handlers.RssFeedHandler.Feeds.GDATASecurityBlogGerman
Assembly: GistBackend
File(s): /home/runner/work/the-gist-of-it-sec/the-gist-of-it-sec/backend/GistBackend/Handlers/RssFeedHandler/Feeds/GDATASecurityBlogGerman.cs
Line coverage
0%
Covered lines: 0
Uncovered lines: 13
Coverable lines: 13
Total lines: 36
Line coverage: 0%
Branch coverage
0%
Covered branches: 0
Total branches: 4
Branch coverage: 0%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
get_RssUrl()100%210%
get_Language()100%210%
get_Type()100%210%
ExtractText(...)0%2040%

File(s)

/home/runner/work/the-gist-of-it-sec/the-gist-of-it-sec/backend/GistBackend/Handlers/RssFeedHandler/Feeds/GDATASecurityBlogGerman.cs

#LineLine coverage
 1using GistBackend.Exceptions;
 2using GistBackend.Types;
 3using HtmlAgilityPack;
 4using static System.Net.WebUtility;
 5using static GistBackend.Types.FeedType;
 6using static GistBackend.Types.Language;
 7
 8namespace GistBackend.Handlers.RssFeedHandler.Feeds;
 9
 10public record GDATASecurityBlogGerman : RssFeed
 11{
 012    public override Uri RssUrl => new("https://feeds.feedblitz.com/GDataSecurityBlog-DE&x=1");
 013    public override Language Language => De;
 014    public override FeedType Type => Blog;
 15
 16    public override string ExtractText(string content)
 17    {
 018        var doc = new HtmlDocument();
 019        doc.LoadHtml(content);
 20
 021        var entryContent = doc.DocumentNode.SelectSingleNode("//div[@class='nm-article-blog']");
 022        if (entryContent == null)
 23        {
 024            throw new ExtractingEntryTextException("Missing container element");
 25        }
 26
 027        var textContent = entryContent.InnerText;
 028        if (string.IsNullOrWhiteSpace(textContent))
 29        {
 030            throw new ExtractingEntryTextException("No text found in container");
 31        }
 32
 033        var decodedText = HtmlDecode(textContent);
 034        return decodedText.Trim();
 35    }
 36}