The old .Url property on IPublishedContent is marked as obsolete and will dissapear. It has been replaced by an extension method in Umbraco.Web namespace.
The old .Url property was easy to mock:
content.Setup(x => x.Url).Returns(url);
Now it doesn’t work to mock the Setup of the property because it is an extension method and they can’t be mocked. Using a wrapper around the extension method doesn’t work either.
If I skip setting up the extension method then my unit tests will throw a null reference exception because the UmbracoMapper lib from Andy Butland requires the Url() to be set.
Any advice?
This is a companion discussion topic for the original entry at https://our.umbraco.com/forum/103908-how-to-unit-test-with-the-new-url-extension-method-throws-exception-and-cant-mock-it