PrintsCharming / ObjectHydrator

This project allows you to pass custom POCO's to it, and have it return an instance of the class populated with randomly generated data. This random data can be overridden by convention.
Apache License 2.0
39 stars 19 forks source link

Support Arrays #6

Closed andy-uq closed 9 years ago

andy-uq commented 9 years ago

The existing implemenation throws an exception when trying to populate a complex class with a property with an Array. I modified the generator so it will create empty arrays instead, after which you can manually assign an Array generator to the property (inherits from List Generator).

I also included a change where you can supply a generator to the list generator so it can make collections of strings, instead of just collections of complex types (due to string not having a default constructor).

PrintsCharming commented 9 years ago

Fantastic Andy!

I'm on the road right now but I'll check it out shortly.

Sent from my phone, please pardon the occasional auto-correct hilarity.

On Mar 17, 2015, at 9:04 PM, Andy Clarke notifications@github.com wrote:

The existing implemenation throws an exception when trying to populate a complex class with a property with an Array. I modified the generator so it will create empty arrays instead, after which you can manually assign an Array generator to the property (inherits from List Generator).

I also included a change where you can supply a generator to the list generator so it can make collections of strings, instead of just collections of complex types (due to string not having a default constructor).

You can view, comment on, or merge this pull request online at:

https://github.com/PrintsCharming/ObjectHydrator/pull/6

Commit Summary

Support Arrays File Changes

M Foundation.ObjectHydrator.Tests/HydratorTests/Hydrator_ComplexCustomer_Tests.cs (25) M Foundation.ObjectHydrator.Tests/POCOs/ComplexCustomer.cs (2) M Foundation.ObjectHydrator/Foundation.ObjectHydrator.csproj (1) A Foundation.ObjectHydrator/Generators/ArrayGenerator.cs (18) M Foundation.ObjectHydrator/Generators/Generator.cs (5) M Foundation.ObjectHydrator/Generators/ListGenerator.cs (11) Patch Links:

https://github.com/PrintsCharming/ObjectHydrator/pull/6.patch https://github.com/PrintsCharming/ObjectHydrator/pull/6.diff — Reply to this email directly or view it on GitHub.