Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Genfu instances #146

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

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