Closed RaulSebastian closed 2 years ago
sorry for the issue, I just figured it out.
The global
configuration does the work:
AutoFaker.Configure(builder =>
{
builder.WithOverride(_ => new Faker().PickRandom(CardType.GetAll()));
});
Issue can be closed.
Given the enumeration class with a private constructor, how can I configure AutoBogus.AutoFaker to use my custom strategy when generating such a class ?
In Example:
I'd like to configure AutoBogus.AutoFaker in such way, that whenever it tries to generates a
CardType
it would use my code instead of not finding a public constructor and returningnull
.I have tried
CardTypeFaker : AutoFaker<CardType>
but it only allows to configure Rules for properties of the class, not the instantiation of the class itsself.I know I could create such an AutoFaker config for every class holding a
CardType
but that seems tedious.