Skip to content

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

@wekempf

Description

@wekempf

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.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions