PeanutButter
Loading...
Searching...
No Matches
PeanutButter.TestUtils.AspNetCore.Builders.ActionExecutingContextBuilder Class Reference

Constructs an ActionExecutingContext. More...

Inheritance diagram for PeanutButter.TestUtils.AspNetCore.Builders.ActionExecutingContextBuilder:
PeanutButter.TestUtils.AspNetCore.Builders.Builder< TBuilder, TSubject >

Public Member Functions

 ActionExecutingContextBuilder ()
ActionExecutingContextBuilder WithActionArgument (string key, object value)
 Sets an action argument on the ActionExecutingContext.
ActionExecutingContextBuilder WithAction (string action)
 Sets the "action" route parameter.
ActionExecutingContextBuilder WithRouteValue (string key, string value)
 Sets a value on the associated route data.
ActionExecutingContextBuilder WithController< T > (T controller)
 Sets the controller for the ActionExecutingContext.
ActionExecutingContextBuilder ForController< T > ()
 Short-hand to assign a controller which has no constructor parameters.
ActionExecutingContextBuilder WithHeader (string header, string value)
 Sets an header on the HttpContext.Request of the ActionExecutingContext.
ActionExecutingContextBuilder WithFilterMetadata (IFilterMetadata metadata)
 Adds filter metadata to the ActionExecutingContext.
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 ActionExecutingContext ConstructEntity ()
 Constructs the fake ActionExecutingContext.
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.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]

Detailed Description

Constructs an ActionExecutingContext.

Member Function Documentation

◆ ConstructEntity()

override ActionExecutingContext PeanutButter.TestUtils.AspNetCore.Builders.ActionExecutingContextBuilder.ConstructEntity ( )
protectedvirtual

Constructs the fake ActionExecutingContext.

Returns
Exceptions
MissingConstructorRequirementException<ActionExecutingContext>

Reimplemented from PeanutButter.TestUtils.AspNetCore.Builders.Builder< TBuilder, TSubject >.

◆ ForController< T >()

ActionExecutingContextBuilder PeanutButter.TestUtils.AspNetCore.Builders.ActionExecutingContextBuilder.ForController< T > ( )

Short-hand to assign a controller which has no constructor parameters.

Template Parameters
T
Returns
Type Constraints
T :ControllerBase 
T :new() 

◆ WithAction()

ActionExecutingContextBuilder PeanutButter.TestUtils.AspNetCore.Builders.ActionExecutingContextBuilder.WithAction ( string action)

Sets the "action" route parameter.

Parameters
action
Returns

◆ WithActionArgument()

ActionExecutingContextBuilder PeanutButter.TestUtils.AspNetCore.Builders.ActionExecutingContextBuilder.WithActionArgument ( string key,
object value )

Sets an action argument on the ActionExecutingContext.

Parameters
key
value
Returns

◆ WithController< T >()

ActionExecutingContextBuilder PeanutButter.TestUtils.AspNetCore.Builders.ActionExecutingContextBuilder.WithController< T > ( T controller)

Sets the controller for the ActionExecutingContext.

Parameters
controller
Template Parameters
T
Returns
Type Constraints
T :ControllerBase 

◆ WithFilterMetadata()

ActionExecutingContextBuilder PeanutButter.TestUtils.AspNetCore.Builders.ActionExecutingContextBuilder.WithFilterMetadata ( IFilterMetadata metadata)

Adds filter metadata to the ActionExecutingContext.

Parameters
metadata
Returns

◆ WithHeader()

ActionExecutingContextBuilder PeanutButter.TestUtils.AspNetCore.Builders.ActionExecutingContextBuilder.WithHeader ( string header,
string value )

Sets an header on the HttpContext.Request of the ActionExecutingContext.

Parameters
header
value
Returns

◆ WithRouteValue()

ActionExecutingContextBuilder PeanutButter.TestUtils.AspNetCore.Builders.ActionExecutingContextBuilder.WithRouteValue ( string key,
string value )

Sets a value on the associated route data.

Parameters
key
value
Returns

The documentation for this class was generated from the following file:
  • source/TestUtils/PeanutButter.TestUtils.AspNetCore/Builders/ActionExecutingContextBuilder.cs