I have code that generates html via TagBuilders How could I test if the right HTML is generated? My TagBuilder is not as simple as just one tag, it also contains other tags. So I have a function that returns TagBuilder object with following HTML
<div>
<input type="checkbox" name=".." /> <label for=".." />
<input type="checkbox" name=".." /> <label for=".." />
<input type="checkbox" name=".." /> <label for=".." />
<div/>
So, to test if we have first checkbox we do:
Assert.True(MyTag.InnerHtml.Contains("<input type="checkbox" name=".." />");
This seems wrong. Is there another way to do this?