Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Need some help writing mock tests implementation for surface controllers. Unable to mock IPublishedContent methods in Umbraco *
IPublishedContent
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.
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Mocking Umbraco8 IPublishedContent siteSettings Descendants method
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.and able to successfully mock content in SiteSettings object.
but looking to mock the SiteSettings Descendants as mentioned in the line below.
Any inputs or Suggestions greatly appreciated. Thanks in advance.
is working on a reply...