Search code examples
episerverepiserver-7

EpiServer - easy way to mock UrlResolver


Is there an easy way to mock UrlResolver class? I pass it as a parameter to the constructor.

public Service(UrlResolver urlResolver){
    _urlResolver = urlResolver;
}

EDIT: According to Henrik N. comment, this issue had been addressed in EpiServer 8.

But until I have an EpiServer 8 in my solution I will use custom interface + adapter.


Solution

  • The dependency that is causing the issue was removed in version 8.0.0 of EPiServer.CMS.Core so if you can update to the latest version you should be fine.