|
ImmediateTaskRunnerBuilder | WithDefaultHandlers () |
ImmediateTaskRunnerBuilder | WithNotStartedHandlerFor< T > () |
ImmediateTaskRunnerBuilder | WithTaskRunner (ITaskRunner taskRunner) |
ImmediateTaskRunnerBuilder | WithSupportForTaskOfType< T > () |
ImmediateTaskRunnerBuilder | WithSupportForContinuationOfType< T, TNext > () |
override ITaskRunner | Build () |
| Builds the instance of TEntity, applying all builder actions in order to provide the required entity.
|
Public Member Functions inherited from PeanutButter.RandomGenerators.GenericBuilder< TBuilder, TEntity > |
IGenericBuilder | GenericWithRandomProps () |
| Sets up the builder to build with random property values unless the level specified is too deep, in which case it bails out.- Returns
- The current builder instance
|
IGenericBuilder | WithBuildLevel (int level) |
| Sets the maximum depth to traverse when randomizing properties.- Parameters
-
level | How far down the rabbit-hole to go |
- Returns
- The builder
|
object | GenericBuild () |
| Builds an instance of the object this builder builds.- Returns
- Instance of object for which this builder is designed, with all properties as default values
|
object | GenericDeepBuild () |
| Builds an instance of the object this builder builds.- Returns
- Instance of object for which this builder is designed, with properties default but complex objects filled in default
|
TBuilder | WithProp (Action< TEntity > action) |
| Generic method to set a property on the entity.
|
TBuilder | WithProp (ActionRef< TEntity > action) |
| Generic method to set a property on an entity when that entity is a struct type.
|
virtual TEntity | ConstructEntity () |
| Constructs a new instance of the entity. Mostly, an inheritor won't have to care, but if your entity has no parameterless constructor, you'll want to override this in your derived builder.
|
virtual TBuilder | WithDefaultDateTimeKind (DateTimeKind dateTimeKind) |
| Sets the default DateTimeKind to be expected on DateTime properties randomly generated by this builder.
|
virtual TBuilder | WithRandomProps () |
| Randomizes all properties on the instance of TEntity being built. This method will use methods from RandomValueGen and may generate new GenericBuilder types for generating more complex properties.
|
virtual TBuilder | WithFilledCollections () |
| Attempts to fill collections with random data. May fail with stack-overflows on complex, cyclic-referencing objects. Not enabled by default on random builds, use with caution – may lead to a stack overflow with collections which contain items whose types which have collections with items whose types... and so on.
|
|
Static Public Member Functions inherited from PeanutButter.RandomGenerators.GenericBuilder< TBuilder, TEntity > |
static TBuilder | Create () |
| Creates a new instance of the builder; used to provide a fluent syntax NB: You must implement anew this in a derived class if you expect decorations (eg [RequireNonNull]) to be properly applied at all levels after using syntax like DerivedBuilder.BuildRandom() or DerivedBuilder.Create().WithRandomProps().Build()
|
static TEntity | BuildDefault () |
| Builds a default instance of the entity.
|
static TEntity | BuildRandom () |
| Convenience method: Creates a builder, sets random properties, returns a new instance of the entity.
|
static void | WithDefaultProp (Action< TEntity > action) |
| Adds a default property setter, shared amongst all instances of this particular builder type.
|
Static Public Member Functions inherited from PeanutButter.RandomGenerators.GenericBuilderBase |
static bool | TryCreateSubstituteFor< T > (bool callThrough, out T result) |
| Attempt to create a substitute for the given type.
|
static bool | TryCreateSubstituteFor< T > (bool callThrough, object[] constructorParameters, out T result) |
| Attempt to create a substitute for the given type with parameters.
|
static bool | TryCreateSubstituteFor< T > (bool throwOnError, bool callThrough, out T result) |
| Attempt to create a substitute from a type with a parameterless constructor.
|
static bool | TryCreateSubstituteFor< T > (bool throwOnError, bool callThrough, object[] constructorParameters, out T result) |
| Attempts perform Substitute.For<T>.
|
Public Attributes inherited from PeanutButter.RandomGenerators.GenericBuilder< TBuilder, TEntity > |
readonly List< object > | CreatedValues = new() |
Static Public Attributes inherited from PeanutButter.RandomGenerators.GenericBuilderBase |
const string | ENV_FORCE_NSUBSTITUTE_FOR_RANDOMVALUEGEN = "FORCE_NSUBSTITUTE_FOR_RANDOMVALUEGEN" |
| The environment variable which is observed to force using NSubstitute for random value generation of interface types.
|
Static Protected Member Functions inherited from PeanutButter.RandomGenerators.GenericBuilderBase |
static Assembly | FindOrLoadAssembly< T > (string name, bool retrying) |
| Attempts to load the assembly alongside the Type T.
|
Static Protected Attributes inherited from PeanutButter.RandomGenerators.GenericBuilderBase |
static readonly Dictionary< Type, Type > | DynamicBuilders = new Dictionary<Type, Type>() |
| Holds a lookup of all GenericBuilder classes which have been generated to facilitate automatic property building. Searched when looking for a builder to generate a property before attempting to generate a builder type (re-use)
|
static readonly Dictionary< Type, Type > | UserBuilders = new Dictionary<Type, Type>() |
| Holds a lookup of GenericBuilder classes which were provided by consuming code. Searched before searching the DynamicBuilders lookup or attempting to create an auto-generated builder type.
|
static readonly Type | NullableGeneric = typeof(Nullable<>) |
| Provides a lookup to the type which is the generic Nulllable.
|
static readonly Type | GenericBuilderBaseType = typeof(GenericBuilderBase) |
| Provides a lookup to the type which is the GenericBuilder.
|
Properties inherited from PeanutButter.RandomGenerators.GenericBuilder< TBuilder, TEntity > |
object[] | ParameterValues [get] |
bool | Success = true [get, set] |
Properties inherited from PeanutButter.RandomGenerators.GenericBuilderBase |
static int | MaxRandomPropsLevel = 10 [get, set] |
| Sets the maximum level to go to when generating random properties of random properties, to prevent stack and memory overflows.
|