29 lines
840 B
C#
29 lines
840 B
C#
|
using Newsbot.Collector.Services.HtmlParser;
|
||
|
|
||
|
namespace Newsbot.Collector.Tests.Services;
|
||
|
|
||
|
public class BrowserClientTests
|
||
|
{
|
||
|
[Fact]
|
||
|
public void LoadsBrowser()
|
||
|
{
|
||
|
using var client = new BrowserClient();
|
||
|
var pageSource = client.GetPageSource("https://www.google.com");
|
||
|
if (pageSource == "") Assert.Fail("failed to return page source");
|
||
|
}
|
||
|
|
||
|
[Fact]
|
||
|
public void CanLoadHeadersFromSource()
|
||
|
{
|
||
|
using var bClient = new BrowserClient();
|
||
|
var pageSource = bClient.GetPageSource("https://www.youtube.com/gamegrumps");
|
||
|
|
||
|
var hClient = new HtmlPageReader(new HtmlPageReaderOptions
|
||
|
{
|
||
|
SourceCode = pageSource
|
||
|
});
|
||
|
hClient.Parse();
|
||
|
|
||
|
if (hClient.Data.Header.YoutubeChannelID is null) Assert.Fail("Failed to find the YoutubeChannelId");
|
||
|
}
|
||
|
}
|