Skip to content

Add support to create HtmlHelper instances for testing purposes #4843

@drauch

Description

@drauch

We are writing our own tag helpers which make use of HtmlHelper internally (e.g., to render an Editor). This seems to be the recommended behavior, see also https://docs.microsoft.com/en-us/aspnet/core/mvc/views/tag-helpers/intro#tag-helpers-compared-to-html-helpers

For unit testing purposes we could "rather easily" instantiate an HtmlHelper in ASP.NET MVC 5 (e.g., see https://stackoverflow.com/questions/25206507/unit-testing-htmlhelper-extension-method-fails/25216750#25216750). This is no longer the case in ASP.NET Core. Is there a utility or some other easy way to instantiate an HtmlHelper for a unit test?

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-mvcIncludes: MVC, Actions and Controllers, Localization, CORS, most templatesenhancementThis issue represents an ask for new feature or an enhancement to an existing onehelp wantedUp for grabs. We would accept a PR to help resolve this issue

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions