|
PeanutButter
|
Builds a ModelBindingContext for testing. More...
Public Member Functions | |
| override ModelBindingContextBuilder | Randomize () |
| ModelBindingContextBuilder () | |
| ModelBindingContextBuilder | WithModelValue (StringValues value) |
| Convenience method to set the value for the model. Cannot be used in conjunction with a custom value provider. | |
| ModelBindingContextBuilder | WithSuccessfulModelBindingResult () |
| Sets a successful Result property from Model on the ModelBindingContext at the time the mutation is run. | |
| ModelBindingContextBuilder | WithFailedModelBindingResult () |
| Sets a failed Result property. | |
| ModelBindingContextBuilder | WithModelBindingResult (ModelBindingResult modelBindingResult) |
| Sets the Result property. | |
| ModelBindingContextBuilder | WithModelBindingResult (Func< object, ModelBindingResult > modelBindingResultGenerator) |
| Sets a Result by generating it from the current Model on the ModelBindingContext. | |
| ModelBindingContextBuilder | WithValueProvider (IValueProvider valueProvider) |
| Resets the main ValueProvider (which defaults to a CompositeValueProvider) | |
| ModelBindingContextBuilder | WithPartialValueProvider (IValueProvider valueProvider) |
| Adds a ValueProvider to the CompositeValueProvider provided by the ValueProvider property. Will reset the ValueProvider to be a CompositeValueProvider if it isn't one already. | |
| ModelBindingContextBuilder | WithValidationState (ValidationStateDictionary validationState) |
| Sets the ValidationState property. | |
| ModelBindingContextBuilder | WithPropertyFilter (Func< ModelMetadata, bool > propertyFilter) |
| Sets the PropertyFilter property. | |
| ModelBindingContextBuilder | WithModelState (ModelStateDictionary modelState) |
| Sets the ModelState property. | |
| ModelBindingContextBuilder | WithModelMetadata (ModelMetadata modelMetadata) |
| Sets the ModelMetadata property. | |
| ModelBindingContextBuilder | WithModel (object model) |
| Sets the Model property. | |
| ModelBindingContextBuilder | WithFieldName (string fieldName) |
| Sets the FieldName property. | |
| ModelBindingContextBuilder | WithTopLevelObject (bool isTopLevelObject) |
| Sets the IsTopLevelObject property. | |
| ModelBindingContextBuilder | WithBindingSource (BindingSource bindingSource) |
| Sets the BindingSource property. | |
| ModelBindingContextBuilder | WithModelName (string modelName) |
| Sets the ModelName property. | |
| ModelBindingContextBuilder | WithActionContext (ActionContext ctx) |
| Sets the action context for the model-binding context. | |
| Public Member Functions inherited from PeanutButter.TestUtils.AspNetCore.Builders.RandomizableBuilder< TBuilder, TSubject > | |
| TBuilder | Randomize () |
| Derivatives must implement this so that BuildRandom can work. | |
| Public Member Functions inherited from PeanutButter.TestUtils.AspNetCore.Builders.Builder< TBuilder, TSubject > | |
| TBuilder | With (Action< TSubject > action) |
| Adds a mutator for the artifact. | |
| virtual TSubject | Build () |
| Builds the subject artifact. | |
| Mutator (Action< T > action, string identifier) | |
Protected Member Functions | |||
| override ModelBindingContext | ConstructEntity () | ||
Override in a derivative builder to provide a custom implementation for TSubject.
| |||
| Protected Member Functions inherited from PeanutButter.TestUtils.AspNetCore.Builders.Builder< TBuilder, TSubject > | |||
| TBuilder | With (Action< TSubject > action, string identifier) | ||
| Adds an identified mutator for the artifact - if a mutator with the same identity already exists, it will be removed. | |||
| TBuilder | With< TCast > (Action< TCast > action) | ||
| Adds a mutator for the artifact, cast to TCast. | |||
| TBuilder | With< TCast > (Action< TCast > action, string identifier) | ||
| Adds an identified mutator for the artifact, cast to TCast. | |||
| TBuilder | WithRandomTimes (Action< TSubject > action) | ||
| Applies the given mutator a random (1-4) number of times. | |||
| TBuilder | WithRandomTimes< TCast > (Action< TCast > action) | ||
| Applies the given mutator on a cast item a random (1-4) number of times. | |||
| TBuilder | WithPreCursor (Action toRun) | ||
| Run a precursor before your entity is constructed - use when your entity requires constructor parameters you'd like to make user-tweakable via builder methods. | |||
| TBuilder | WithPostBuild (Action< TSubject > action) | ||
| Add post-build actions. | |||
Additional Inherited Members | |
| Static Public Member Functions inherited from PeanutButter.TestUtils.AspNetCore.Builders.RandomizableBuilder< TBuilder, TSubject > | |
| static TSubject | BuildRandom () |
| Builds a random variant output artifact. | |
| Static Public Member Functions inherited from PeanutButter.TestUtils.AspNetCore.Builders.Builder< TBuilder, TSubject > | |
| static TBuilder | Create () |
| Returns a new instance of the builder. | |
| static TSubject | BuildDefault () |
| Builds the default output artifact. | |
| Static Protected Member Functions inherited from PeanutButter.TestUtils.AspNetCore.Builders.Builder< TBuilder, TSubject > | |
| static void | WarnIf (bool condition, string message) |
| Print a traced warning if the condition is found to be false. | |
| static void | ErrorIf (bool condition, string message) |
| Print a traced warning if the condition is found to be false. | |
| Protected Attributes inherited from PeanutButter.TestUtils.AspNetCore.Builders.Builder< TBuilder, TSubject > | |
| TSubject | CurrentEntity |
| During build, CurrentEntity will be set to the currently-building entity. You may implement actualizer(s) in your derivative to pull this value in lazily to consumers. | |
| Properties inherited from PeanutButter.TestUtils.AspNetCore.Builders.Builder< TBuilder, TSubject > | |
| Action< T > | Action [get] |
| string | Identifier [get] |
Builds a ModelBindingContext for testing.
|
protectedvirtual |
Override in a derivative builder to provide a custom implementation for TSubject.
| CustomConstructEntityRequired |
Reimplemented from PeanutButter.TestUtils.AspNetCore.Builders.Builder< TBuilder, TSubject >.
| ModelBindingContextBuilder PeanutButter.TestUtils.AspNetCore.Builders.ModelBindingContextBuilder.WithActionContext | ( | ActionContext | ctx | ) |
Sets the action context for the model-binding context.
| ctx |
| ModelBindingContextBuilder PeanutButter.TestUtils.AspNetCore.Builders.ModelBindingContextBuilder.WithBindingSource | ( | BindingSource | bindingSource | ) |
Sets the BindingSource property.
| bindingSource |
| ModelBindingContextBuilder PeanutButter.TestUtils.AspNetCore.Builders.ModelBindingContextBuilder.WithFailedModelBindingResult | ( | ) |
Sets a failed Result property.
| ModelBindingContextBuilder PeanutButter.TestUtils.AspNetCore.Builders.ModelBindingContextBuilder.WithFieldName | ( | string | fieldName | ) |
Sets the FieldName property.
| fieldName |
| ModelBindingContextBuilder PeanutButter.TestUtils.AspNetCore.Builders.ModelBindingContextBuilder.WithModel | ( | object | model | ) |
Sets the Model property.
| model |
| ModelBindingContextBuilder PeanutButter.TestUtils.AspNetCore.Builders.ModelBindingContextBuilder.WithModelBindingResult | ( | Func< object, ModelBindingResult > | modelBindingResultGenerator | ) |
Sets a Result by generating it from the current Model on the ModelBindingContext.
| modelBindingResultGenerator |
| ModelBindingContextBuilder PeanutButter.TestUtils.AspNetCore.Builders.ModelBindingContextBuilder.WithModelBindingResult | ( | ModelBindingResult | modelBindingResult | ) |
Sets the Result property.
| modelBindingResult |
| ModelBindingContextBuilder PeanutButter.TestUtils.AspNetCore.Builders.ModelBindingContextBuilder.WithModelMetadata | ( | ModelMetadata | modelMetadata | ) |
Sets the ModelMetadata property.
| modelMetadata |
| ModelBindingContextBuilder PeanutButter.TestUtils.AspNetCore.Builders.ModelBindingContextBuilder.WithModelName | ( | string | modelName | ) |
Sets the ModelName property.
| modelName |
| ModelBindingContextBuilder PeanutButter.TestUtils.AspNetCore.Builders.ModelBindingContextBuilder.WithModelState | ( | ModelStateDictionary | modelState | ) |
Sets the ModelState property.
| modelState |
| ModelBindingContextBuilder PeanutButter.TestUtils.AspNetCore.Builders.ModelBindingContextBuilder.WithModelValue | ( | StringValues | value | ) |
Convenience method to set the value for the model. Cannot be used in conjunction with a custom value provider.
| value |
| ModelBindingContextBuilder PeanutButter.TestUtils.AspNetCore.Builders.ModelBindingContextBuilder.WithPartialValueProvider | ( | IValueProvider | valueProvider | ) |
Adds a ValueProvider to the CompositeValueProvider provided by the ValueProvider property. Will reset the ValueProvider to be a CompositeValueProvider if it isn't one already.
| valueProvider |
| ModelBindingContextBuilder PeanutButter.TestUtils.AspNetCore.Builders.ModelBindingContextBuilder.WithPropertyFilter | ( | Func< ModelMetadata, bool > | propertyFilter | ) |
Sets the PropertyFilter property.
| propertyFilter |
| ModelBindingContextBuilder PeanutButter.TestUtils.AspNetCore.Builders.ModelBindingContextBuilder.WithSuccessfulModelBindingResult | ( | ) |
Sets a successful Result property from Model on the ModelBindingContext at the time the mutation is run.
| ModelBindingContextBuilder PeanutButter.TestUtils.AspNetCore.Builders.ModelBindingContextBuilder.WithTopLevelObject | ( | bool | isTopLevelObject | ) |
Sets the IsTopLevelObject property.
| isTopLevelObject |
| ModelBindingContextBuilder PeanutButter.TestUtils.AspNetCore.Builders.ModelBindingContextBuilder.WithValidationState | ( | ValidationStateDictionary | validationState | ) |
Sets the ValidationState property.
| validationState |
| ModelBindingContextBuilder PeanutButter.TestUtils.AspNetCore.Builders.ModelBindingContextBuilder.WithValueProvider | ( | IValueProvider | valueProvider | ) |
Resets the main ValueProvider (which defaults to a CompositeValueProvider)
| valueProvider |