Setting locale using Faker<T> inheritance. #446
Answered
by
ChristoWolf
manscronholm
asked this question in
Q&A
-
How do u set the locale while using the inheritance approach? I tried setting the Locale property in my constructor, but it still seems to default back to english. Example:
|
Beta Was this translation helpful? Give feedback.
Answered by
ChristoWolf
Oct 26, 2023
Replies: 1 comment 1 reply
-
Hi @antabuze! You should call the public sealed class CompanyFaker : Faker<Company>
{
private CompanyFaker() : base("sv")
{
RuleFor(c => c.Id, f => f.Random.Guid());
RuleFor(c => c.Name, f => f.Company.CompanyName());
}
} |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
bchavez
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi @antabuze!
You should call the
base
constructor.Using your example: