using System.Net;

namespace CartWise.Web.Tests;

// Rendered Razor output HTML-encodes special characters (e.g. ' -> &#x27;), so raw substring
// assertions against response bodies produce false negatives for ordinary test data. Decode first.
internal static class HtmlAssert
{
    public static void Contains(string expectedText, string html)
    {
        Assert.Contains(expectedText, WebUtility.HtmlDecode(html));
    }

    public static void DoesNotContain(string expectedText, string html)
    {
        Assert.DoesNotContain(expectedText, WebUtility.HtmlDecode(html));
    }
}
