From 1adc2892db4abe910dec707d8945780c0b276133 Mon Sep 17 00:00:00 2001 From: "kay.one" Date: Fri, 15 Feb 2013 20:16:33 -0800 Subject: [PATCH] fixed broken tests. --- NzbDrone.Core/Datastore/IdService.cs | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/NzbDrone.Core/Datastore/IdService.cs b/NzbDrone.Core/Datastore/IdService.cs index 77004655d..1a8887736 100644 --- a/NzbDrone.Core/Datastore/IdService.cs +++ b/NzbDrone.Core/Datastore/IdService.cs @@ -35,25 +35,20 @@ namespace NzbDrone.Core.Datastore modelBase.Id = _indexProvider.Next(obj.GetType()); } - foreach (var propertyInfo in GetPotentialProperties(obj.GetType())) + var list = obj as IEnumerable; + if (list != null) { - var propValue = propertyInfo.GetValue(obj, null); - - var list = propValue as IEnumerable; - - if (list != null) - { - foreach (var item in list) - { - EnsureIds(item, context); - } - } - else + foreach (var item in list) { - EnsureIds(propValue, context); - + EnsureIds(item, context); } + return; + } + foreach (var propertyInfo in GetPotentialProperties(obj.GetType())) + { + var propValue = propertyInfo.GetValue(obj, null); + EnsureIds(propValue, context); } }