Although there are tag helpers now, you still need HtmlHelper
from time to time, e.g., inside your tag helpers. I'm trying to write tests for one of my tag helpers which calls into HtmlHelper
.
In ASP.NET MVC 5 there have been ways to create an HtmlHelper for testing purposes, e.g., see https://mcmap.net/q/276151/-unit-testing-htmlhelper-extension-method-fails
However, the ctor changed extensively in ASP.NET Core.
What is a good way to create an HtmlHelper for testing purposes using ASP.NET Core 1.1?
IHtmlHelper
interface? That can be injected into the constructor of the tag helper, which makes mocking trivial. – Gormandize