Fixes tests, adds null checks

This commit is contained in:
Shannon
2016-04-06 12:05:52 +02:00
parent 6856540a7c
commit 75be22a778
2 changed files with 9 additions and 4 deletions

View File

@@ -74,9 +74,10 @@ namespace Umbraco.Tests.UmbracoExamine
mediaService = Mock.Of<IMediaService>(
x => x.GetPagedDescendants(
It.IsAny<int>(), It.IsAny<int>(), It.IsAny<int>(), out totalRecs, It.IsAny<string>(), It.IsAny<Direction>(), It.IsAny<bool>(), It.IsAny<string>())
It.IsAny<int>(), It.IsAny<long>(), It.IsAny<int>(), out totalRecs, It.IsAny<string>(), It.IsAny<Direction>(), It.IsAny<bool>(), It.IsAny<string>())
==
allRecs);
}
if (dataTypeService == null)
{

View File

@@ -1201,6 +1201,7 @@ namespace Umbraco.Web
/// <returns>Enumerates bottom-up ie walking up the tree (parent, grand-parent, etc).</returns>
internal static IEnumerable<IPublishedContent> EnumerateAncestors(this IPublishedContent content, bool orSelf)
{
if (content == null) throw new ArgumentNullException("content");
if (orSelf) yield return content;
while ((content = content.Parent) != null)
yield return content;
@@ -1373,6 +1374,7 @@ namespace Umbraco.Web
internal static IEnumerable<IPublishedContent> EnumerateDescendants(this IPublishedContent content, bool orSelf)
{
if (content == null) throw new ArgumentNullException("content");
if (orSelf) yield return content;
foreach (var child in content.Children)
@@ -1707,6 +1709,7 @@ namespace Umbraco.Web
public static T Parent<T>(this IPublishedContent content)
where T : class, IPublishedContent
{
if (content == null) throw new ArgumentNullException("content");
return content.Parent as T;
}
@@ -1724,9 +1727,10 @@ namespace Umbraco.Web
/// <para>This method exists for consistency, it is the same as calling content.Children as a property.</para>
/// </remarks>
public static IEnumerable<IPublishedContent> Children(this IPublishedContent content)
{
return content.Children;
}
{
if (content == null) throw new ArgumentNullException("content");
return content.Children;
}
/// <summary>
/// Gets the children of the content, filtered by a predicate.