lundi 11 juillet 2016

ASP.MVC: How to unit test html tag helper

Is there any sophisticated way how to unit test the results of HtmlHelpers? For example I have a helper that generates html markup for my custom inputs (I am using TagBuilder inside). The result is IHtmlString which I have to convert to string and compare it with expected string in unit tests. But this becomes very complicated, since in html I dont care about attributes order, I have to escape expected strings etc. Any ideas how to test it more cleaner?

Aucun commentaire:

Enregistrer un commentaire