@@ -242,20 +242,20 @@ private object GetFilledObject(Type type, FillerSetupItem currentSetupItem, Hash
242242
243243 if ( TypeIsDictionary ( type ) )
244244 {
245- IDictionary dictionary = GetFilledDictionary ( type , currentSetupItem ) ;
245+ IDictionary dictionary = GetFilledDictionary ( type , currentSetupItem , typeTracker ) ;
246246
247247 return dictionary ;
248248 }
249249
250250 if ( TypeIsList ( type ) )
251251 {
252- IList list = GetFilledList ( type , currentSetupItem ) ;
252+ IList list = GetFilledList ( type , currentSetupItem , typeTracker ) ;
253253 return list ;
254254 }
255255
256256 if ( type . IsInterface )
257257 {
258- return GetInterfaceInstance ( type , currentSetupItem ) ;
258+ return GetInterfaceInstance ( type , currentSetupItem , typeTracker ) ;
259259 }
260260
261261 if ( TypeIsPoco ( type ) )
@@ -317,7 +317,7 @@ private object GetFilledPoco(Type type, FillerSetupItem currentSetupItem, HashSt
317317 return result ;
318318 }
319319
320- private IDictionary GetFilledDictionary ( Type propertyType , FillerSetupItem currentSetupItem )
320+ private IDictionary GetFilledDictionary ( Type propertyType , FillerSetupItem currentSetupItem , HashStack < Type > typeTracker )
321321 {
322322 IDictionary dictionary = ( IDictionary ) Activator . CreateInstance ( propertyType ) ;
323323 Type keyType = propertyType . GetGenericArguments ( ) [ 0 ] ;
@@ -327,7 +327,7 @@ private IDictionary GetFilledDictionary(Type propertyType, FillerSetupItem curre
327327 currentSetupItem . DictionaryKeyMaxCount ) ;
328328 for ( int i = 0 ; i < maxDictionaryItems ; i ++ )
329329 {
330- object keyObject = GetFilledObject ( keyType , currentSetupItem ) ;
330+ object keyObject = GetFilledObject ( keyType , currentSetupItem , typeTracker ) ;
331331
332332 if ( dictionary . Contains ( keyObject ) )
333333 {
@@ -336,7 +336,7 @@ private IDictionary GetFilledDictionary(Type propertyType, FillerSetupItem curre
336336 throw new ArgumentException ( message ) ;
337337 }
338338
339- object valueObject = GetFilledObject ( valueType , currentSetupItem ) ;
339+ object valueObject = GetFilledObject ( valueType , currentSetupItem , typeTracker ) ;
340340 dictionary . Add ( keyObject , valueObject ) ;
341341 }
342342 return dictionary ;
@@ -348,7 +348,7 @@ private static bool HasTypeARandomFunc(Type type, FillerSetupItem currentSetupIt
348348 }
349349
350350
351- private IList GetFilledList ( Type propertyType , FillerSetupItem currentSetupItem )
351+ private IList GetFilledList ( Type propertyType , FillerSetupItem currentSetupItem , HashStack < Type > typeTracker )
352352 {
353353 Type genType = propertyType . GetGenericArguments ( ) [ 0 ] ;
354354
@@ -374,13 +374,13 @@ private IList GetFilledList(Type propertyType, FillerSetupItem currentSetupItem)
374374 int maxListItems = Random . Next ( currentSetupItem . ListMinCount , currentSetupItem . ListMaxCount ) ;
375375 for ( int i = 0 ; i < maxListItems ; i ++ )
376376 {
377- object listObject = GetFilledObject ( genType , currentSetupItem ) ;
377+ object listObject = GetFilledObject ( genType , currentSetupItem , typeTracker ) ;
378378 list . Add ( listObject ) ;
379379 }
380380 return list ;
381381 }
382382
383- private object GetInterfaceInstance ( Type interfaceType , FillerSetupItem setupItem )
383+ private object GetInterfaceInstance ( Type interfaceType , FillerSetupItem setupItem , HashStack < Type > typeTracker )
384384 {
385385 object result ;
386386 if ( setupItem . TypeToRandomFunc . ContainsKey ( interfaceType ) )
@@ -405,7 +405,7 @@ private object GetInterfaceInstance(Type interfaceType, FillerSetupItem setupIte
405405 MethodInfo genericMethod = method . MakeGenericMethod ( new [ ] { interfaceType } ) ;
406406 result = genericMethod . Invoke ( setupItem . InterfaceMocker , null ) ;
407407 }
408- FillInternal ( result ) ;
408+ FillInternal ( result , typeTracker ) ;
409409 return result ;
410410 }
411411
0 commit comments