nickdodd79 / AutoBogus

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

Add generator for System.Version #30

Closed logiclrd closed 4 years ago

logiclrd commented 4 years ago

In our project, we naively pointed AutoBogus at a type containing a Version property, and the resulting Version object was initialized in an odd way, with Build and Revision set to -1 and no bogus data in Major or Minor. This PR adds a default VersionGenerator to AutoBogus so that Version objects are generated with valid (non-negative) random integers in all properties.

A unit test verifies the new functionality.

logiclrd commented 4 years ago

Force push: https://github.com/logiclrd/AutoBogus/compare/1413e22..94ec2e3

logiclrd commented 4 years ago

Okay I was too quick on the trigger with that, a bunch of unit tests now fail with this change and it appears to be because the testing infrastructure cannot abide a primitive set to its default value, and the version's .MajorRevision has value 0 == default(short). Hmm...