22using AngleSharp ;
33using AngleSharp . Dom ;
44using AngleSharp . Html . Parser ;
5+ using Egil . AngleSharp . Diffing . Core ;
6+ using Xunit ;
57
6- namespace Egil . AngleSharp . Diffing . Core
8+ namespace Egil . AngleSharp . Diffing
79{
8- public abstract class DiffingTestBase
10+ public abstract class DiffingTestBase : IClassFixture < DiffingTestFixture >
911 {
10- private readonly IBrowsingContext _context ;
11- private readonly IHtmlParser _htmlParser ;
12- private readonly IDocument _document ;
12+ private readonly DiffingTestFixture _testFixture ;
1313
1414 protected INodeList EmptyNodeList => ToNodeList ( "" ) ;
1515
16- protected DiffingTestBase ( )
16+ public DiffingTestBase ( DiffingTestFixture fixture )
1717 {
18- var config = Configuration . Default . WithCss ( ) ;
19- _context = BrowsingContext . New ( config ) ;
20- _htmlParser = _context . GetService < IHtmlParser > ( ) ;
21- _document = _context . OpenNewAsync ( ) . Result ;
18+ _testFixture = fixture ;
2219 }
2320
2421 protected INodeList ToNodeList ( string ? htmlsnippet )
2522 {
26- var fragment = _htmlParser . ParseFragment ( htmlsnippet , _document . Body ) ;
23+ var fragment = _testFixture . Parse ( htmlsnippet ) ;
2724 return fragment ;
2825 }
2926
@@ -34,7 +31,7 @@ protected IEnumerable<ComparisonSource> ToComparisonSourceList(string html)
3431
3532 protected INode ToNode ( string htmlsnippet )
3633 {
37- var fragment = _htmlParser . ParseFragment ( htmlsnippet , _document . Body ) ;
34+ var fragment = _testFixture . Parse ( htmlsnippet ) ;
3835 return fragment [ 0 ] ;
3936 }
4037
0 commit comments