@@ -20,7 +20,7 @@ public static class MarkupMatchesAssertExtensions
2020 /// <param name="expected">The expected markup fragment.</param>
2121 /// <param name="userMessage">A custom user message to display in case the verification fails.</param>
2222 [ AssertionMethod ]
23- public static void MarkupMatches ( this string actual , string expected , string ? userMessage = null )
23+ public static void MarkupMatches ( [ StringSyntax ( "Html" ) ] this string actual , [ StringSyntax ( "Html" ) ] string expected , string ? userMessage = null )
2424 {
2525 if ( actual is null )
2626 throw new ArgumentNullException ( nameof ( actual ) ) ;
@@ -42,7 +42,7 @@ public static void MarkupMatches(this string actual, string expected, string? us
4242 /// <param name="expected">The expected <see cref="IRenderedFragment"/>.</param>
4343 /// <param name="userMessage">A custom user message to display in case the verification fails.</param>
4444 [ AssertionMethod ]
45- public static void MarkupMatches ( this string actual , IRenderedFragment expected , string ? userMessage = null )
45+ public static void MarkupMatches ( [ StringSyntax ( "Html" ) ] this string actual , IRenderedFragment expected , string ? userMessage = null )
4646 {
4747 if ( actual is null )
4848 throw new ArgumentNullException ( nameof ( actual ) ) ;
@@ -62,7 +62,7 @@ public static void MarkupMatches(this string actual, IRenderedFragment expected,
6262 /// <param name="expected">The expected <see cref="INodeList"/>.</param>
6363 /// <param name="userMessage">A custom user message to display in case the verification fails.</param>
6464 [ AssertionMethod ]
65- public static void MarkupMatches ( this string actual , INodeList expected , string ? userMessage = null )
65+ public static void MarkupMatches ( [ StringSyntax ( "Html" ) ] this string actual , INodeList expected , string ? userMessage = null )
6666 {
6767 if ( actual is null )
6868 throw new ArgumentNullException ( nameof ( actual ) ) ;
@@ -82,7 +82,7 @@ public static void MarkupMatches(this string actual, INodeList expected, string?
8282 /// <param name="expected">The expected <see cref="INode"/>.</param>
8383 /// <param name="userMessage">A custom user message to display in case the verification fails.</param>
8484 [ AssertionMethod ]
85- public static void MarkupMatches ( this string actual , INode expected , string ? userMessage = null )
85+ public static void MarkupMatches ( [ StringSyntax ( "Html" ) ] this string actual , INode expected , string ? userMessage = null )
8686 {
8787 if ( actual is null )
8888 throw new ArgumentNullException ( nameof ( actual ) ) ;
@@ -102,7 +102,7 @@ public static void MarkupMatches(this string actual, INode expected, string? use
102102 /// <param name="expected">The expected markup.</param>
103103 /// <param name="userMessage">A custom user message to display in case the verification fails.</param>
104104 [ AssertionMethod ]
105- public static void MarkupMatches ( this IRenderedFragment actual , string expected , string ? userMessage = null )
105+ public static void MarkupMatches ( this IRenderedFragment actual , [ StringSyntax ( "Html" ) ] string expected , string ? userMessage = null )
106106 {
107107 if ( actual is null )
108108 throw new ArgumentNullException ( nameof ( actual ) ) ;
@@ -182,7 +182,7 @@ public static void MarkupMatches(this INode actual, IRenderedFragment expected,
182182 /// <param name="expected">The expected markup.</param>
183183 /// <param name="userMessage">A custom user message to display in case the verification fails.</param>
184184 [ AssertionMethod ]
185- public static void MarkupMatches ( this INode actual , string expected , string ? userMessage = null )
185+ public static void MarkupMatches ( this INode actual , [ StringSyntax ( "Html" ) ] string expected , string ? userMessage = null )
186186 {
187187 if ( actual is null )
188188 throw new ArgumentNullException ( nameof ( actual ) ) ;
@@ -203,7 +203,7 @@ public static void MarkupMatches(this INode actual, string expected, string? use
203203 /// <param name="expected">The expected markup.</param>
204204 /// <param name="userMessage">A custom user message to display in case the verification fails.</param>
205205 [ AssertionMethod ]
206- public static void MarkupMatches ( this INodeList actual , string expected , string ? userMessage = null )
206+ public static void MarkupMatches ( this INodeList actual , [ StringSyntax ( "Html" ) ] string expected , string ? userMessage = null )
207207 {
208208 if ( actual is null )
209209 throw new ArgumentNullException ( nameof ( actual ) ) ;
@@ -355,7 +355,7 @@ public static void MarkupMatches(this INodeList actual, RenderFragment expected,
355355 /// <param name="expected">The expected markup fragment.</param>
356356 /// <param name="userMessage">A custom user message to display in case the verification fails.</param>
357357 [ AssertionMethod ]
358- public static void MarkupMatches ( this IEnumerable < IElement > actual , string expected , string ? userMessage = null )
358+ public static void MarkupMatches ( this IEnumerable < IElement > actual , [ StringSyntax ( "Html" ) ] string expected , string ? userMessage = null )
359359 {
360360 if ( actual is null )
361361 throw new ArgumentNullException ( nameof ( actual ) ) ;
@@ -473,9 +473,7 @@ private static INodeList ToNodeList(this IEnumerable<IElement> elements, BunitHt
473473 using var parser = new BunitHtmlParser ( ) ;
474474 return nodesStr . ToNodeList ( parser ) ;
475475 }
476- else
477- {
478- return nodesStr . ToNodeList ( htmlParser ) ;
479- }
476+
477+ return nodesStr . ToNodeList ( htmlParser ) ;
480478 }
481479}
0 commit comments