nickdodd79 / AutoBogus

A C# library complementing the Bogus generator by adding auto creation and population capabilities.
MIT License
436 stars 50 forks source link

AutoGeneratorOverride populates overridden properties one level early #88

Open gregwinterstein opened 2 years ago

gregwinterstein commented 2 years ago

Properties overridden in AutoGeneratorOverride classes are populated one level (depth) earlier than properties that are not overridden in an AutoGeneratorOverride. I would expect that all properties would be populated at the same level (depth).

Example:

1: Root: ObjectId: '-1817912126', FullName: 'Herbert Kub'
2: TestObject: Id: '0', Name: 'transmit non-volatile', Description: ''
  * 2nd level property populated at depth of 1: model.TestObject.Name: 'transmit non-volatile'
3: TestObject.TestObject3: null

Depth = 2
1: Root: ObjectId: '-2083317722', FullName: 'Garrett Olson'
2: TestObject: Id: '76558413', Name: 'virtual Credit Card Account', Description: 'program'
3: TestObject.TestObject3: Id: '0', Name: 'glupagb0cuhwme6fm', Phone: '671-084-4687'
  * 3rd level property populated at depth of 2: model.TestObject.TestObject3.Name: 'glupagb0cuhwme6fm'
  * 3rd level property populated at depth of 2: model.TestObject.TestObject3.Phone: '671-084-4687'

Depth = 3
1: Root: ObjectId: '-880326354', FullName: 'Gudrun Leffler'
2: TestObject: Id: '-1081389418', Name: 'e-tailers alliance', Description: 'Borders'
3: TestObject.TestObject3: Id: '1779062458', Name: '6gqhifdobdtmo23li', Phone: '616-568-6395'

Attached is an example program showing this behavior: TestAutoBogus.zip