-Fixed PR test

This commit is contained in:
James Newton-King
2015-04-03 12:10:23 +13:00
2 changed files with 8 additions and 10 deletions
@@ -234,7 +234,7 @@ namespace Newtonsoft.Json.Tests.Serialization
Assert.IsNotNull(o); Assert.IsNotNull(o);
Assert.IsNotNull(o.Logger); Assert.IsNotNull(o.Logger);
Assert.IsNotNull(o.Repository); Assert.IsNotNull(o.Repository);
Assert.IsNotNull(o.Repository.CreatedOn); Assert.AreEqual(o.Repository.CreatedOn, DateTime.Parse("2015-04-01 20:00"));
Assert.AreEqual(2, count); Assert.AreEqual(2, count);
@@ -883,17 +883,15 @@ namespace Newtonsoft.Json.Utilities
{ {
ValidationUtils.ArgumentNotNull(targetType, "targetType"); ValidationUtils.ArgumentNotNull(targetType, "targetType");
List<PropertyInfo> propertyInfos; List<PropertyInfo> propertyInfos = new List<PropertyInfo>(targetType.GetProperties(bindingAttr));
if (!targetType.IsInterface()) // GetProperties on an interface doesn't return properties from its interfaces
if (targetType.IsInterface())
{ {
propertyInfos = new List<PropertyInfo>(targetType.GetProperties(bindingAttr)); foreach (Type i in targetType.GetInterfaces())
} {
else propertyInfos.AddRange(i.GetProperties(bindingAttr));
{ }
propertyInfos = (new Type[] { targetType })
.Concat(targetType.GetInterfaces())
.SelectMany(i => i.GetProperties(bindingAttr)).ToList();
} }
GetChildPrivateProperties(propertyInfos, targetType, bindingAttr); GetChildPrivateProperties(propertyInfos, targetType, bindingAttr);