PeanutButter
|
Builds a controller context. More...
Public Member Functions | |
ControllerContextBuilder () | |
ControllerContextBuilder | WithRouteDataValue (string key, string value) |
Sets a RouteData value (eg "controller", "action", etc) | |
ControllerContextBuilder | WithRouteData (RouteData routeData) |
Sets the RouteData on the context. | |
ControllerContextBuilder | WithHttpContext (HttpContext context) |
Sets the http context for the controller. | |
ControllerContextBuilder | WithRequest (HttpRequest request) |
Sets the request on the http context for the controller (if possible) | |
ControllerContextBuilder | WithResponse (HttpResponse response) |
Sets the response on the http context for the controller (if possible) | |
ControllerContextBuilder | WithActionDescriptor (ControllerActionDescriptor descriptor) |
Sets the ControllerActionDescriptor on the context. | |
ControllerContextBuilder | WithControllerType (Type type) |
Sets the controller type on the action descriptor (as well as taking a guess at the name) | |
ControllerContextBuilder | WithIdentity (IIdentity identity) |
Add the identity to the available claims identities. | |
ControllerContextBuilder | WithUser (ClaimsPrincipal user) |
Sets the User on the HttpContext of the ControllerContext. | |
ControllerContextBuilder | WithHttpContextMutator (Action< FakeHttpContext > mutator) |
Facilitates easier http context mutations. | |
ControllerContextBuilder | WithController< T > (T controller) |
Associates the context with the provided controller. | |
ControllerContextBuilder | WithRequestHeader (string header, string value) |
Set a request header on the associated http context. | |
ControllerContextBuilder | WithAction (string name) |
Sets the action on the context. | |
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) |
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. | |
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. | |
virtual TSubject | ConstructEntity () |
Override in a derivative builder to provide a custom implementation for TSubject. | |
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. | |
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 controller context.
ControllerContextBuilder PeanutButter.TestUtils.AspNetCore.Builders.ControllerContextBuilder.WithAction | ( | string | name | ) |
Sets the action on the context.
name |
ControllerContextBuilder PeanutButter.TestUtils.AspNetCore.Builders.ControllerContextBuilder.WithActionDescriptor | ( | ControllerActionDescriptor | descriptor | ) |
Sets the ControllerActionDescriptor on the context.
descriptor |
ControllerContextBuilder PeanutButter.TestUtils.AspNetCore.Builders.ControllerContextBuilder.WithController< T > | ( | T | controller | ) |
Associates the context with the provided controller.
controller |
T |
T | : | ControllerBase |
ControllerContextBuilder PeanutButter.TestUtils.AspNetCore.Builders.ControllerContextBuilder.WithControllerType | ( | Type | type | ) |
Sets the controller type on the action descriptor (as well as taking a guess at the name)
type |
ControllerContextBuilder PeanutButter.TestUtils.AspNetCore.Builders.ControllerContextBuilder.WithHttpContext | ( | HttpContext | context | ) |
Sets the http context for the controller.
context |
ControllerContextBuilder PeanutButter.TestUtils.AspNetCore.Builders.ControllerContextBuilder.WithHttpContextMutator | ( | Action< FakeHttpContext > | mutator | ) |
Facilitates easier http context mutations.
mutator |
ControllerContextBuilder PeanutButter.TestUtils.AspNetCore.Builders.ControllerContextBuilder.WithIdentity | ( | IIdentity | identity | ) |
Add the identity to the available claims identities.
identity |
ControllerContextBuilder PeanutButter.TestUtils.AspNetCore.Builders.ControllerContextBuilder.WithRequest | ( | HttpRequest | request | ) |
Sets the request on the http context for the controller (if possible)
request |
ControllerContextBuilder PeanutButter.TestUtils.AspNetCore.Builders.ControllerContextBuilder.WithRequestHeader | ( | string | header, |
string | value ) |
Set a request header on the associated http context.
header | |
value |
ControllerContextBuilder PeanutButter.TestUtils.AspNetCore.Builders.ControllerContextBuilder.WithResponse | ( | HttpResponse | response | ) |
Sets the response on the http context for the controller (if possible)
response |
ControllerContextBuilder PeanutButter.TestUtils.AspNetCore.Builders.ControllerContextBuilder.WithRouteData | ( | RouteData | routeData | ) |
Sets the RouteData on the context.
routeData |
ControllerContextBuilder PeanutButter.TestUtils.AspNetCore.Builders.ControllerContextBuilder.WithRouteDataValue | ( | string | key, |
string | value ) |
Sets a RouteData value (eg "controller", "action", etc)
key | |
value |
ControllerContextBuilder PeanutButter.TestUtils.AspNetCore.Builders.ControllerContextBuilder.WithUser | ( | ClaimsPrincipal | user | ) |
Sets the User on the HttpContext of the ControllerContext.
user |