asiftasleem / nbuilder

Automatically exported from code.google.com/p/nbuilder
0 stars 0 forks source link

Patch To Add Feature To ExtensibleRandomValuePropertyNamer -- Expose Member Info To Namer Delegates #43

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Please accept the attached patch -- an enhancement to the
ExtensibleRandomValuePropertyNamer.  I found a use case where I would like
the custom namer delegate to know about the member being set.  Fortunately
this was a very small and simple change.

One can imagine lots of uses for this.  In my case I have some classes that
are use Data Annotation attributes for validation.  For string members
decorated with the StringLength attibute, I want to set the value to the
max allowed string length.

Original issue reported on code.google.com by timtast...@gmail.com on 19 Mar 2010 at 10:45

Attachments:

GoogleCodeExporter commented 8 years ago
Hi again Tim,

I've had a look at this patch and it seemed simple enough to apply. I have 
committed it at revision 74.

I must admit that I don't 100% understand the full extent to which this 
enhancement will be used and the unit test demonstrated a syntax that isn't all 
that simple.

Is the unit test you provided the best example of the normal use case this 
enhancement will be used for?

Anyway, hope this helps and thanks again for the patch,
Joshua Roth

Original comment by joshuajr...@gmail.com on 20 Sep 2010 at 12:09

GoogleCodeExporter commented 8 years ago
Yeah, the test does not show a practical use.  The immediate use I had is 
mentioned in my original report.  

To elaborate, say my objects' string properties are decorated with a 
StringLength attribute that has a max equal to the the size of database column 
that the property is mapped to.  By exposing the property's member info to the 
namer, it can generate a random string value with a maximum length as specified 
by the attribute.  This might be a useful alternative to always keeping the 
random values smaller than the smallest column in the whole system in order to 
avoid SQL errors in integration tests.

Original comment by timtast...@gmail.com on 23 Sep 2010 at 5:18

GoogleCodeExporter commented 8 years ago
Hey Gareth,

Can you please verify that you're happy for this change to go into the release.

Thanks,
Josh

Original comment by joshuajr...@gmail.com on 21 Oct 2010 at 11:47

GoogleCodeExporter commented 8 years ago

Original comment by garethdo...@googlemail.com on 6 Nov 2010 at 5:20

GoogleCodeExporter commented 8 years ago

Original comment by garethdo...@googlemail.com on 11 Nov 2010 at 9:40

GoogleCodeExporter commented 8 years ago
This was fixed in version 3.0

Original comment by joshuajr...@gmail.com on 30 Nov 2011 at 12:41