I noticed that even with a defined seed, dates are by default changing. This due to the default value of the reference date that is defined as DateTime.Now.
This is a flaw in my eyes since you should get the same value when generating with a seed. Same seed, same value.
So I think there should be a static reference date that can be set like the seed as well that applies by default.
so
private const Seed = 123456;
var faker = new Fake<MyClass>()
.UseSeed(Seed)
.RuleFor(x => x.Date, f => f.Date.Recent());
var myClass = faker.Generate();
public class MyClass
{
public DateTime Date{ get; set; }
}
If you run this in a unit test, the Date property will be different every time you run it.
Hi
I noticed that even with a defined seed, dates are by default changing. This due to the default value of the reference date that is defined as DateTime.Now.
This is a flaw in my eyes since you should get the same value when generating with a seed. Same seed, same value. So I think there should be a static reference date that can be set like the seed as well that applies by default.
so
If you run this in a unit test, the
Date
property will be different every time you run it.