I created several custom Mvc6 TagHelpers and I would like to test their outputs other than on the app.
I've been trying to set up a Unit Test but I'm unable to mock the TagHelperContext.
[Fact]
public void TextboxTagHelperTest()
{
var t = new TextboxTagHelper();
var m = new Model1();
var attr = new TagHelperAttributeList();
attr.Add(new TagHelperAttribute("asp-for", m.MyProperty));
var thc = new TagHelperContext(attr, new Dictionary<object, object>(), "");
var o = new TagHelperOutput("united-textbox", attr, null);
t.Process(thc, o);
Debug.Write(o);
}
As anyone set up a Unit Test for Mvc6 TagHelpers?
Aucun commentaire:
Enregistrer un commentaire