forked from VahidN/DNTCommon.Web.Core
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHtmlReaderServiceTests.cs
More file actions
28 lines (25 loc) · 928 Bytes
/
Copy pathHtmlReaderServiceTests.cs
File metadata and controls
28 lines (25 loc) · 928 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace DNTCommon.Web.Core.Tests;
[TestClass]
public class HtmlReaderServiceTests : TestsBase
{
[TestMethod]
public void TestExtractImagesLinksReturnsAllImages()
{
ServiceProvider.RunScopedService<IHtmlReaderService>(htmlReaderService =>
{
var items = htmlReaderService.ParseHtml(HtmlHelperServiceTests.Html).HtmlNodes.ToList();
Assert.AreEqual(expected: 8, actual: items.Count(node => node.Name == "img"));
});
}
[TestMethod]
public void TestExtractLinksReturnsAllLinks()
{
ServiceProvider.RunScopedService<IHtmlReaderService>(htmlReaderService =>
{
var items = htmlReaderService.ParseHtml(HtmlHelperServiceTests.Html).HtmlNodes.ToList();
Assert.AreEqual(expected: 4, actual: items.Count(node => node.Name == "a"));
});
}
}