PeanutButter
|
Builds your. More...
Public Member Functions | |
ControllerBuilder () | |
ControllerBuilder< TController > | WithTempDataProvider (Func< ITempDataProvider > func) |
Set up a factory for a TempDataProvider. | |
ControllerBuilder< TController > | WithFactory (Func< TController > factory) |
Provide a factory to create the controller. If your controller has constructor parameters, this is how you'd inject them. | |
ControllerBuilder< TController > | WithRequestQueryParameter (string parameter, string value) |
Set a query parameter on the request object NB: this will not automatically map to method parameters on your actions, so you only need to set these if you're interrogating the raw query or want to update the overall querystring. | |
ControllerBuilder< TController > | WithRequestHost (string host) |
Sets the hostname for the request. | |
ControllerBuilder< TController > | WithRequestPort (int port) |
Sets the port for the request. | |
ControllerBuilder< TController > | WithRequestHost (HostString host) |
Sets the host for the request. | |
ControllerBuilder< TController > | WithRequestScheme (string scheme) |
Sets the scheme for the request. | |
ControllerBuilder< TController > | WithRequestQueryParameter (string parameter, StringValues value) |
Sets a query parameter on the request for the controller. | |
ControllerBuilder< TController > | WithHttpContextItem (string key, object value) |
Sets an item on the http context for the controller. | |
ControllerBuilder< TController > | WithRequestCookie (string key, string value) |
Sets a cookie value on the request for the controller. | |
ControllerBuilder< TController > | WithRequestCookies (IDictionary< string, string > cookies) |
Sets a bunch of cookies on the request for the controller. | |
ControllerBuilder< TController > | WithRequestHeader (string header, string value) |
Sets a header on the request for the controller. | |
ControllerBuilder< TController > | WithControllerContext (ControllerContext ctx) |
Sets the controller context for your controller. | |
ControllerBuilder< TController > | WithActionDescriptor (ControllerActionDescriptor actionDescriptor) |
Sets the action descriptor for your controller. | |
ControllerBuilder< TController > | WithRouteData (RouteData data) |
Sets the route data for your controller. | |
ControllerBuilder< TController > | WithRouteDataValue (string key, object value) |
Sets some route data value. | |
ControllerBuilder< TController > | WithHttpContext (HttpContext context) |
Sets the http context for your controller. | |
ControllerBuilder< TController > | WithOptions (IOptions< MvcOptions > options) |
Set the options for the controller. | |
ControllerBuilder< TController > | WithOptions (Func< IOptions< MvcOptions > > factory) |
Set the options for the controller (late-resolved singleton) | |
ControllerBuilder< TController > | WithTempDataDictionaryFactory (ITempDataDictionaryFactory tempDataDictionaryFactory) |
Set the temp data dictionary factory for the controller. | |
ControllerBuilder< TController > | WithTempDataDictionaryFactory (Func< ITempDataDictionaryFactory > factoryFactory) |
Set the temp data dictionary factory for the controller (late-resolved singleton) | |
ControllerBuilder< TController > | WithModelValidator (IObjectModelValidator validator) |
Set the model validator. | |
ControllerBuilder< TController > | WithModelValidator (Func< IObjectModelValidator > factory) |
Set the model validator (late-resolved singleton) | |
ControllerBuilder< TController > | WithModelMetadataProvider (Func< IModelMetadataProvider > modelMetadataProvider) |
Set the model metadata provider. | |
ControllerBuilder< TController > | WithModelMetadataProvider (IModelMetadataProvider modelMetadataProvider) |
Set the model metadata provider (late-bound singleton) | |
ControllerBuilder< TController > | WithActionContext (Func< ControllerContext, ActionContext > factory) |
Set the action context (will be automatically called when you set the http context). This variant will have access to the controller so it can access any property of said controller. | |
ControllerBuilder< TController > | WithActionContext (ActionContext actionContext) |
Set the action context (late-bound singleton) | |
ControllerBuilder< TController > | WithAction (string name) |
Sets the action on the controller descriptor. If the action can be found on the controller, the controller descriptor's method info will also be set. | |
ControllerBuilder< TController > | WithRequestUrl (string url) |
Sets the url on the associated request. Does NOT set any routing parameters (eg action) | |
ControllerBuilder< TController > | WithRequestUrl (Uri url) |
Sets the url on the associated request. Does NOT set any routing parameters (eg action) | |
ControllerBuilder< TController > | WithRequestMutator (Action< FakeHttpRequest > mutator) |
Facilitates arbitrary mutations on the existing FakeHttpRequest for this build. | |
ControllerBuilder< TController > | WithRequestHeaders (IDictionary< string, string > headers) |
Set multiple request headers at once. | |
ControllerBuilder< TController > | WithRequestMethod (string method) |
Set the request method for the associated request. | |
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 TController | ConstructEntity () |
Constructs the controller, either using a provided factory or with the assumption that the controller has a parameterless constructor. | |
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] |
Builds your.
TController |
TController | : | ControllerBase |
|
protectedvirtual |
Constructs the controller, either using a provided factory or with the assumption that the controller has a parameterless constructor.
Reimplemented from PeanutButter.TestUtils.AspNetCore.Builders.Builder< TBuilder, TSubject >.
ControllerBuilder< TController > PeanutButter.TestUtils.AspNetCore.Builders.ControllerBuilder< TController >.WithAction | ( | string | name | ) |
Sets the action on the controller descriptor. If the action can be found on the controller, the controller descriptor's method info will also be set.
name |
ControllerBuilder< TController > PeanutButter.TestUtils.AspNetCore.Builders.ControllerBuilder< TController >.WithActionContext | ( | ActionContext | actionContext | ) |
Set the action context (late-bound singleton)
actionContext |
ControllerBuilder< TController > PeanutButter.TestUtils.AspNetCore.Builders.ControllerBuilder< TController >.WithActionContext | ( | Func< ControllerContext, ActionContext > | factory | ) |
Set the action context (will be automatically called when you set the http context). This variant will have access to the controller so it can access any property of said controller.
factory |
ControllerBuilder< TController > PeanutButter.TestUtils.AspNetCore.Builders.ControllerBuilder< TController >.WithActionDescriptor | ( | ControllerActionDescriptor | actionDescriptor | ) |
Sets the action descriptor for your controller.
actionDescriptor |
ControllerBuilder< TController > PeanutButter.TestUtils.AspNetCore.Builders.ControllerBuilder< TController >.WithControllerContext | ( | ControllerContext | ctx | ) |
Sets the controller context for your controller.
ctx |
ControllerBuilder< TController > PeanutButter.TestUtils.AspNetCore.Builders.ControllerBuilder< TController >.WithFactory | ( | Func< TController > | factory | ) |
Provide a factory to create the controller. If your controller has constructor parameters, this is how you'd inject them.
factory |
ControllerBuilder< TController > PeanutButter.TestUtils.AspNetCore.Builders.ControllerBuilder< TController >.WithHttpContext | ( | HttpContext | context | ) |
Sets the http context for your controller.
context |
ControllerBuilder< TController > PeanutButter.TestUtils.AspNetCore.Builders.ControllerBuilder< TController >.WithHttpContextItem | ( | string | key, |
object | value ) |
Sets an item on the http context for the controller.
key | |
value |
ControllerBuilder< TController > PeanutButter.TestUtils.AspNetCore.Builders.ControllerBuilder< TController >.WithModelMetadataProvider | ( | Func< IModelMetadataProvider > | modelMetadataProvider | ) |
Set the model metadata provider.
modelMetadataProvider |
ControllerBuilder< TController > PeanutButter.TestUtils.AspNetCore.Builders.ControllerBuilder< TController >.WithModelMetadataProvider | ( | IModelMetadataProvider | modelMetadataProvider | ) |
Set the model metadata provider (late-bound singleton)
modelMetadataProvider |
ControllerBuilder< TController > PeanutButter.TestUtils.AspNetCore.Builders.ControllerBuilder< TController >.WithModelValidator | ( | Func< IObjectModelValidator > | factory | ) |
Set the model validator (late-resolved singleton)
factory |
ControllerBuilder< TController > PeanutButter.TestUtils.AspNetCore.Builders.ControllerBuilder< TController >.WithModelValidator | ( | IObjectModelValidator | validator | ) |
Set the model validator.
validator |
ControllerBuilder< TController > PeanutButter.TestUtils.AspNetCore.Builders.ControllerBuilder< TController >.WithOptions | ( | Func< IOptions< MvcOptions > > | factory | ) |
Set the options for the controller (late-resolved singleton)
factory |
ControllerBuilder< TController > PeanutButter.TestUtils.AspNetCore.Builders.ControllerBuilder< TController >.WithOptions | ( | IOptions< MvcOptions > | options | ) |
Set the options for the controller.
options |
ControllerBuilder< TController > PeanutButter.TestUtils.AspNetCore.Builders.ControllerBuilder< TController >.WithRequestCookie | ( | string | key, |
string | value ) |
Sets a cookie value on the request for the controller.
key | |
value |
ControllerBuilder< TController > PeanutButter.TestUtils.AspNetCore.Builders.ControllerBuilder< TController >.WithRequestCookies | ( | IDictionary< string, string > | cookies | ) |
Sets a bunch of cookies on the request for the controller.
cookies |
InvalidOperationException |
ControllerBuilder< TController > PeanutButter.TestUtils.AspNetCore.Builders.ControllerBuilder< TController >.WithRequestHeader | ( | string | header, |
string | value ) |
Sets a header on the request for the controller.
header | |
value |
ControllerBuilder< TController > PeanutButter.TestUtils.AspNetCore.Builders.ControllerBuilder< TController >.WithRequestHeaders | ( | IDictionary< string, string > | headers | ) |
Set multiple request headers at once.
headers |
ControllerBuilder< TController > PeanutButter.TestUtils.AspNetCore.Builders.ControllerBuilder< TController >.WithRequestHost | ( | HostString | host | ) |
Sets the host for the request.
host |
ControllerBuilder< TController > PeanutButter.TestUtils.AspNetCore.Builders.ControllerBuilder< TController >.WithRequestHost | ( | string | host | ) |
Sets the hostname for the request.
host |
ControllerBuilder< TController > PeanutButter.TestUtils.AspNetCore.Builders.ControllerBuilder< TController >.WithRequestMethod | ( | string | method | ) |
Set the request method for the associated request.
method |
ControllerBuilder< TController > PeanutButter.TestUtils.AspNetCore.Builders.ControllerBuilder< TController >.WithRequestMutator | ( | Action< FakeHttpRequest > | mutator | ) |
Facilitates arbitrary mutations on the existing FakeHttpRequest for this build.
mutator |
ControllerBuilder< TController > PeanutButter.TestUtils.AspNetCore.Builders.ControllerBuilder< TController >.WithRequestPort | ( | int | port | ) |
Sets the port for the request.
port |
ControllerBuilder< TController > PeanutButter.TestUtils.AspNetCore.Builders.ControllerBuilder< TController >.WithRequestQueryParameter | ( | string | parameter, |
string | value ) |
Set a query parameter on the request object NB: this will not automatically map to method parameters on your actions, so you only need to set these if you're interrogating the raw query or want to update the overall querystring.
parameter | |
value |
ControllerBuilder< TController > PeanutButter.TestUtils.AspNetCore.Builders.ControllerBuilder< TController >.WithRequestQueryParameter | ( | string | parameter, |
StringValues | value ) |
Sets a query parameter on the request for the controller.
parameter | |
value |
ControllerBuilder< TController > PeanutButter.TestUtils.AspNetCore.Builders.ControllerBuilder< TController >.WithRequestScheme | ( | string | scheme | ) |
Sets the scheme for the request.
scheme |
ControllerBuilder< TController > PeanutButter.TestUtils.AspNetCore.Builders.ControllerBuilder< TController >.WithRequestUrl | ( | string | url | ) |
Sets the url on the associated request. Does NOT set any routing parameters (eg action)
url |
ControllerBuilder< TController > PeanutButter.TestUtils.AspNetCore.Builders.ControllerBuilder< TController >.WithRequestUrl | ( | Uri | url | ) |
Sets the url on the associated request. Does NOT set any routing parameters (eg action)
url |
ControllerBuilder< TController > PeanutButter.TestUtils.AspNetCore.Builders.ControllerBuilder< TController >.WithRouteData | ( | RouteData | data | ) |
Sets the route data for your controller.
data |
ControllerBuilder< TController > PeanutButter.TestUtils.AspNetCore.Builders.ControllerBuilder< TController >.WithRouteDataValue | ( | string | key, |
object | value ) |
Sets some route data value.
key | |
value |
ControllerBuilder< TController > PeanutButter.TestUtils.AspNetCore.Builders.ControllerBuilder< TController >.WithTempDataDictionaryFactory | ( | Func< ITempDataDictionaryFactory > | factoryFactory | ) |
Set the temp data dictionary factory for the controller (late-resolved singleton)
factoryFactory |
ControllerBuilder< TController > PeanutButter.TestUtils.AspNetCore.Builders.ControllerBuilder< TController >.WithTempDataDictionaryFactory | ( | ITempDataDictionaryFactory | tempDataDictionaryFactory | ) |
Set the temp data dictionary factory for the controller.
tempDataDictionaryFactory |
ControllerBuilder< TController > PeanutButter.TestUtils.AspNetCore.Builders.ControllerBuilder< TController >.WithTempDataProvider | ( | Func< ITempDataProvider > | func | ) |
Set up a factory for a TempDataProvider.
func |
NotImplementedException |