Closed Eric-Bonneau closed 3 years ago
Hey @Eric-Bonneau
The best approach at the moment would be the override. When you create your Override code, there is a virtual method Preinitialize
which you can use to control whether a value is generated before calling the override.
This details got missed off in the Readme, but should be there now.
Hope that helps.
Nick.
Hi @nickdodd79,
Thanks for the info. Will try this out!
Hi there,
I've ran into a bit of an issue where I'm using AutoBogus to generate a
struct
which has argument guards for its constructor.AutoFaker<T>
as documented here, but it seems like there is aclass
constraint onT
.AutoGeneratorOverride
as documented here, it seems like the property has already been populated at that point.I would new up an
AutoFaker<T>
and use a customRuleFor
with this property, but it seems a bit tedious. Is there a way to easily achieve what I'd like without having to duplicate a bunch ofRuleFor
s?For reference, here is a sample application containing the issue I'm experiencing:
Thanks in advance :).