Skip to content

Commit

Permalink
Fix broken tests - code refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
PREMIER\Njabulo.Nxele committed Aug 2, 2022
1 parent 19279ff commit 8f267e2
Showing 1 changed file with 16 additions and 14 deletions.
30 changes: 16 additions & 14 deletions Dev/Dev2.Core/Converters/Graph/Poco/PocoMapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -134,24 +134,26 @@ void MapEnumarableData(object data, Stack<Tuple<string, bool, bool, object>> pro
{
if (propertyData is IEnumerable enumerableData)
{
byte[] propertyDataByte = propertyData as byte[];
if(propertyData.GetType() == typeof(byte[]))
{
byte[] propertyDataByte = propertyData as byte[];
if (propertyDataByte == null || propertyDataByte.Length == 0)
return;
}

if (propertyDataByte != null && propertyDataByte.Length > 0)
propertyStack.Push(new Tuple<string, bool, bool, object>(propertyInfo.Name, propertyInfo.PropertyType.IsEnumerable(), false, data));
paths.AddRange(BuildPaths(propertyData, propertyStack, root));
propertyStack.Pop();

var enumerator = enumerableData.GetEnumerator();
enumerator.Reset();
if (enumerator.MoveNext())
{
propertyStack.Push(new Tuple<string, bool, bool, object>(propertyInfo.Name, propertyInfo.PropertyType.IsEnumerable(), false, data));
propertyData = enumerator.Current;

propertyStack.Push(new Tuple<string, bool, bool, object>(propertyInfo.Name, propertyInfo.PropertyType.IsEnumerable(), true, data));
paths.AddRange(BuildPaths(propertyData, propertyStack, root));
propertyStack.Pop();

var enumerator = enumerableData.GetEnumerator();
enumerator.Reset();
if (enumerator.MoveNext())
{
propertyData = enumerator.Current;

propertyStack.Push(new Tuple<string, bool, bool, object>(propertyInfo.Name, propertyInfo.PropertyType.IsEnumerable(), true, data));
paths.AddRange(BuildPaths(propertyData, propertyStack, root));
propertyStack.Pop();
}
}
}
}
Expand Down

0 comments on commit 8f267e2

Please sign in to comment.