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

Added support for Nullable Types #20

Closed mayankgoyel closed 6 years ago

mayankgoyel commented 6 years ago

I found that "ObjectHydrator" is not supporting Nullable types. Therefore, I had added the support and also fixed some code warnings and code style issues. Also found a bug related to Enum generator. Hydrator was always selecting first Enum value instead of selecting the random Enum value. Have fixed it with added support for Nullable Enum type.

@PrintsCharming : Could you please review it and merge to have updated nuget package if it is fine with you?

PrintsCharming commented 6 years ago

The appveyor build failed with: Generators\NullableDateTimeGenerator.cs(10,40): error CS0840: 'Foundation.ObjectHydrator.Generators.NullableDateTimeGenerator.MinimumValue.get' must declare a body because it is not marked abstract or extern. Automatically implemented properties must define both get and set accessors. [C:\projects\objecthydrator\Foundation.ObjectHydrator\Foundation.ObjectHydrator.csproj] Generators\NullableDateTimeGenerator.cs(11,40): error CS0840: 'Foundation.ObjectHydrator.Generators.NullableDateTimeGenerator.MaximumValue.get' must declare a body because it is not marked abstract or extern. Automatically implemented properties must define both get and set accessors. [C:\projects\objecthydrator\Foundation.ObjectHydrator\Foundation.ObjectHydrator.csproj]

I'll have to dive in and see why

mayankgoyel commented 6 years ago

@PrintsCharming Hi, it seems that you are building with old version of MSBuild. I had used C# 6 syntax for this change. Could you please make sure to check your MSBuild version? For more details, please refer: https://stackoverflow.com/questions/42069461/error-cs0840-in-msbuild-but-not-in-vs2015

mayankgoyel commented 6 years ago

@PrintsCharming Please let me know if it is not feasible for you to build with C# 6 versions. Then, I can update code to use older C# version syntax.

mayankgoyel commented 6 years ago

@PrintsCharming Did you get a chance to look into this?

mayankgoyel commented 6 years ago

Can someone please get back to me on this?

PrintsCharming commented 6 years ago

I can't seem to get Appveyor to build with c#6.

I'm hoping to manually merge your stuff tonight into 1-3Pre

PrintsCharming commented 6 years ago

Somehow I messed up the PR. Can you create a new one?