Skip to content

Conversation

@marcoregueira
Copy link
Contributor

GenFu has been refactored to allow creation of instances. This will allow creation of specialized generators and usage in DI.

var childGenerator = new GenFuInstance();
var adultGenerator = new GenFuInstance();

childGenerator.Configure<Person>().Fill(x => x.Age).WithinRange(1, 10);
adultGenerator.Configure<Person>().Fill(x => x.Age).WithinRange(20, 100);

Classic static usage is still supported. No breaking changes, as you can see in the tests.

The only breaking change is the class CalendarDate that doesn't support static usage anymore. It could be reworked to avoid the change but that would mean having two versions of this class, the old static and a new one, that could be misleading. I think the impact for this change will be minimum, anyway.

Property fillers are overloaded to allow passing a GenFu instance. They will use the global instance when none is provided to avoid breaking changes, but I have the feeling that requiring an instance would be better for clarity.

The only breaking change is the class CalendarDate that doesn't support static usage anymore.

Property fillers are overloaded to allow passing a GenFu instance. They will use the global instance when none is provided to avoid breaking changes, but I have the feeling that requiring an instance would be better for clarity.
Now there is no difference between using a new instance or the global static instance, therefore the test is still relevant.
This way we avoid interferences with other tests.
This was referenced Dec 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant