Need some help writing mock tests implementation for surface controllers. Unable to mock IPublishedContent methods in Umbraco *
I initially tried to Mock IPublishedContent as mentioned below.
Mock<IPublishedContent> mockIdentifierTypeContent = new Mock<IPublishedContent>();
SiteSettings siteSettings = Umbraco.Content(request.HomePageId) as SiteSettings;
and able to successfully mock content in SiteSettings object.
but looking to mock the SiteSettings Descendants as mentioned in the line below.
siteSettings.Descendants<Registration>().FirstOrDefault(s => s.Id == request.PageId);
public static IEnumerable<T> Descendants<T>(this IPublishedContent content, string culture = null)
where T : class, IPublishedContent
{
return content.Descendants(culture).OfType<T>();
}
Any inputs or Suggestions greatly appreciated.
Thanks in advance.
This is a companion discussion topic for the original entry at https://our.umbraco.com/forum/110873-mocking-umbraco8-ipublishedcontent-sitesettings-descendants-method