-
Notifications
You must be signed in to change notification settings - Fork 1
Commands
TheCodeKing edited this page Sep 28, 2011
·
8 revisions
Overview | Commands
The following table shows the configuration commands which can be used to override default behaviour and set up custom data.
| Configuration Commands | Description |
|---|---|
| With<T>(T value) | Sets the default value for the type T. |
| With<T>(Func<T> factory) | Sets a factory delegate for the creation for type T. |
| With<T>(Func<Type, T> factory) | Sets a factory delegate for the creation for type T based on Type T. |
| Setter<T>(Func<MemberInfo, T> setter) | Sets a member of type T to a value based on the associated MemberInfo instance. |
| Setter(Func<MemberInfo, T> setter) | Sets a member of type the Make type T to a value based on the associated MemberInfo instance. |
| Do<T>(Action<T> expression) | A delegate to invoke against a new instance of type T. Use instead of _Set_ to override members. |
| Do(Action<T> expression) | A delegate to invoke against the Make type T. Use instead of _Set_ to override members. |
| Set<T>(Expression<Func<T, object>> expression, object value) | Sets a member to the given value for type T. Obsolete use _Do_. |
See example usage.
The following table shows the custom configuration commands that can be used when creating an instance. These commands can be extended using example usage.
| Extended Commands | Description |
|---|---|
| Max() | Sets all supported values types to their MaxValue. Enum types are set to the last item, bool is set to true. This is the default. |
| Min() | Sets all supported values types to their MinValue. Enum types are set to the first item, bool is set to false. |
| Default() | Sets all supported values types to their Default. Enum types are set to the first item. |
| EnumerationSize(count) | Populates any ICollection, IList, or Array types with the given number of items. Default is 10. If size is greater than 0 then IDictionary is populated with a single item. |