38 lines
1.1 KiB
C#
38 lines
1.1 KiB
C#
|
using Newsbot.Collector.Services.HtmlParser;
|
||
|
|
||
|
namespace Newsbot.Collector.Tests.Services;
|
||
|
|
||
|
public class HtmlPageReaderTests
|
||
|
{
|
||
|
[Fact]
|
||
|
public void BaseSiteContainsRssFeed()
|
||
|
{
|
||
|
var client = new HtmlPageReader("https://dotnettutorials.net/");
|
||
|
var headClient = new HeadParserClient(client.GetSiteContent());
|
||
|
var feedUri = headClient.GetSiteFeed();
|
||
|
if (feedUri == "")
|
||
|
{
|
||
|
Assert.Fail("Failed to find the RSS feed");
|
||
|
}
|
||
|
}
|
||
|
|
||
|
[Fact]
|
||
|
public void SiteDoesNotReturnRssFeed()
|
||
|
{
|
||
|
var client = new HtmlPageReader("https://www.engadget.com/");
|
||
|
var headClient = new HeadParserClient(client.GetSiteContent());
|
||
|
var feedUri = headClient.GetSiteFeed();
|
||
|
if (feedUri == "")
|
||
|
{
|
||
|
Assert.Fail("");
|
||
|
}
|
||
|
}
|
||
|
|
||
|
[Fact]
|
||
|
public void CanFindBodyOfTheArticle()
|
||
|
{
|
||
|
var client = new HtmlPageReader("https://www.engadget.com/apple-is-convinced-my-dog-is-stalking-me-143100932.html");
|
||
|
var c = client.CollectPostContent();
|
||
|
Console.WriteLine(c);
|
||
|
}
|
||
|
}
|