using Bogus
we can generate fake and random data easily: https://github.com/bchavez/Bogus
Now I need to generate some Person's. They have age
, weight
, height
, so here is my code:
internal class Person
{
public int Age { get; set; }
public int Height { get; set; }
public int Weight { get; set; }
public static Faker<Person> FakeData { get; } =
new Faker<Person>()
.RuleFor(p => p.Age, f => f.Random.Number(8, 90))
.RuleFor(p => p.Height, f => f.Random.Number(70, 200))
.RuleFor(p => p.Weight, f => f.Random.Number(15, 200));
}
It will generate fake and random data very well. But there is a problem. I need to make it conditional. For example it will generate a person with age 9
and the height of 180
!!!
Or a Person with the height of 70
and the weight of 190
. I need to avoid such generationgs.
Any fix way?