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

Need to make it easier to create "factories" for AnonymousData #5

Open
wekempf opened this issue Jul 27, 2018 · 0 comments
Open

Need to make it easier to create "factories" for AnonymousData #5

wekempf opened this issue Jul 27, 2018 · 0 comments

Comments

@wekempf
Copy link
Owner

wekempf commented Jul 27, 2018

Currently the options are to let AnonymousData handle things entirely on it's own, or to provide a complete factory yourself. However, it's often the case that you just want to provide specific instructions for a few properties and allow AnonymousData to handle the rest. Some pseudo code to illustrate the idea (with no suggestion for final syntax on such a feature).

anon.RegisterWith<Person>(cfg => cfg.For(p => p.Age).Use(a => a.AnyInt(0, 100)).For(p => p.Secret).Ignore());

So, AnonymousData would create a Person and populate most of the properties as it normally would, but for Age it generates an int between 0 and 100 and it doesn't populate Secret at all.

This will make "adjusting" the generation for complex types (especially complex trees of types) much simpler.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant