|
PeanutButter
|
Builds an HttpContext. More...
Public Member Functions | |
| override HttpContextBuilder | Randomize () |
| Randomizes the context. | |
| HttpContextBuilder () | |
| Constructs the builder. | |
| HttpContextBuilder | WithDefaultConnection () |
| Populates a ConnectionInfo on the HttpContext with the local and remote addresses both being 127.0.0.1. | |
| HttpContextBuilder | WithRandomConnection () |
| Populates a random ConnectionInfo on the HttpContext. | |
| HttpContextBuilder | WithRequestServices (IServiceProvider serviceProvider) |
| Sets the RequestServices service provider for the context. | |
| HttpContextBuilder | WithItem (object key, object value) |
| Sets an Item on the context. | |
| HttpContextBuilder | WithWebSockets (WebSocketManager webSocketManager) |
| Sets the WebSockets manager on the request. | |
| HttpContextBuilder | WithFeature< TFeature > (TFeature feature) |
| Adds a feature to the request. | |
| HttpContextBuilder | WithFeature< TFeature > (Func< HttpContext, TFeature > factory) |
| Set a feature via a factory which has access to the HttpContext. | |
| HttpContextBuilder | WithUser (ClaimsPrincipal principal) |
| Sets the user on the request. | |
| HttpContextBuilder | WithConnection (ConnectionInfo connectionInfo) |
| Sets the connection info on the request. | |
| HttpContextBuilder | WithResponse (HttpResponse response) |
| Sets the response on the context. | |
| HttpContextBuilder | WithResponse (Func< HttpResponse > accessor) |
| Sets the response accessor on the context. | |
| HttpContextBuilder | WithRequest (HttpRequest request) |
| Sets the request on the context. | |
| HttpContextBuilder | WithRequest (Func< HttpRequest > requestAccessor) |
| Sets the request accessor on the context. | |
| HttpContextBuilder | WithFeatures (IFeatureCollection features) |
| Sets the feature collection on the request. | |
| HttpContextBuilder | WithFormFile (string content, string name, string fileName=null) |
| Adds a form file to the context. | |
| HttpContextBuilder | WithRequestQueryParameter (string key, string value) |
| Sets a query parameter on the request. | |
| HttpContextBuilder | WithRequestQueryParameters (IDictionary< string, string > parameters) |
| Bulk-sets query parameters on the request. | |
| HttpContextBuilder | WithFormField (string key, string value) |
| Adds a form field to the request Use this when what you want to do can be accomplished on the proper IFormCollection type. | |
| HttpContextBuilder | WithFakeRequestFormModifier (Action< FakeFormCollection > modifier) |
| Modifies some aspect of the request form. Use this when you want access to the functionality of the underlying fake. | |
| HttpContextBuilder | WithRequestMutator (Action< HttpRequest > mutator) |
| Modifies some aspect of the request. Use this when what you want to do can be achieved on the proper HttpRequest type. | |
| HttpContextBuilder | WithResponseMutator (Action< HttpResponse > mutator) |
| Modifies some aspect of the response. Use this when what you want to do can be achieved on the proper HttpResponse type. | |
| HttpContextBuilder | WithFakeRequestModifier (Action< FakeHttpRequest > modifier) |
| Modifies some aspect of the request. Use this when you want access to the functionality of the underlying fake. | |
| HttpContextBuilder | WithUrl (Uri uri) |
| Set the full url for the request. | |
| HttpContextBuilder | WithUrl (string url) |
| Set the full url for the request. | |
| HttpContextBuilder | WithTransientService< TService, TImplementation > () |
| Register a transient service. | |
| HttpContextBuilder | WithSingletonService< TService, TImplementation > () |
| Register a singleton service. | |
| HttpContextBuilder | WithService< TService > (TService service) |
| Register a service instance. | |
| HttpContextBuilder | WithService< TService > (Func< HttpContext, TService > factory) |
| Register a service factory. | |
| HttpContextBuilder | WithService< TService > (Func< TService > factory) |
| Register a service factory. | |
| HttpContextBuilder | WithServicesMutator (Action< HttpContext, MinimalServiceProvider > mutator) |
| Open access to apply mutations to the MinimalServiceProvider, if not overridden. | |
| HttpContextBuilder | WithServicesMutator (Action< MinimalServiceProvider > mutator) |
| Open access to apply mutations to the MinimalServiceProvider, if not overridden. | |
| HttpContextBuilder | WithRequestHeader (string key, string value) |
| Set a request header. | |
| HttpContextBuilder | WithRequestCookie (string key, string value) |
| Set a request cookie. | |
| HttpContextBuilder | WithRequestPath (string path) |
| Sets the path on the request. | |
| HttpContextBuilder | WithRequestContentType (string contentType) |
| Sets the ContentType (and related Content-Type header) on the request. | |
| HttpContextBuilder | WithResponseHeader (string key, string value) |
| Set a response header. | |
| HttpContextBuilder | WithRemoteAddress (string ipAddress) |
| Sets the HttpContext.Connection.RemoteIpAddress value. | |
| HttpContextBuilder | WithRemoteAddress (IPAddress address) |
| Sets the HttpContext.Connection.RemoteIpAddress value. | |
| HttpContextBuilder | WithSessionItems (IDictionary< string, object > items) |
| Sets session items on the HttpContext from the provided collection. | |
| HttpContextBuilder | WithSessionItem (string key, object value) |
| Sets an item in the HttpContext.Session. | |
| 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 HttpContext | ConstructEntity () |
| Constructs the fake http context. | |
| 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 an HttpContext.
|
protectedvirtual |
Constructs the fake http context.
Reimplemented from PeanutButter.TestUtils.AspNetCore.Builders.Builder< TBuilder, TSubject >.
| override HttpContextBuilder PeanutButter.TestUtils.AspNetCore.Builders.HttpContextBuilder.Randomize | ( | ) |
Randomizes the context.
| HttpContextBuilder PeanutButter.TestUtils.AspNetCore.Builders.HttpContextBuilder.WithConnection | ( | ConnectionInfo | connectionInfo | ) |
Sets the connection info on the request.
| connectionInfo |
| HttpContextBuilder PeanutButter.TestUtils.AspNetCore.Builders.HttpContextBuilder.WithDefaultConnection | ( | ) |
Populates a ConnectionInfo on the HttpContext with the local and remote addresses both being 127.0.0.1.
| HttpContextBuilder PeanutButter.TestUtils.AspNetCore.Builders.HttpContextBuilder.WithFakeRequestFormModifier | ( | Action< FakeFormCollection > | modifier | ) |
Modifies some aspect of the request form. Use this when you want access to the functionality of the underlying fake.
| modifier |
| HttpContextBuilder PeanutButter.TestUtils.AspNetCore.Builders.HttpContextBuilder.WithFakeRequestModifier | ( | Action< FakeHttpRequest > | modifier | ) |
Modifies some aspect of the request. Use this when you want access to the functionality of the underlying fake.
| modifier |
| HttpContextBuilder PeanutButter.TestUtils.AspNetCore.Builders.HttpContextBuilder.WithFeature< TFeature > | ( | Func< HttpContext, TFeature > | factory | ) |
Set a feature via a factory which has access to the HttpContext.
| factory |
| TFeature |
| HttpContextBuilder PeanutButter.TestUtils.AspNetCore.Builders.HttpContextBuilder.WithFeature< TFeature > | ( | TFeature | feature | ) |
Adds a feature to the request.
| feature |
| TFeature |
| HttpContextBuilder PeanutButter.TestUtils.AspNetCore.Builders.HttpContextBuilder.WithFeatures | ( | IFeatureCollection | features | ) |
Sets the feature collection on the request.
| features |
| HttpContextBuilder PeanutButter.TestUtils.AspNetCore.Builders.HttpContextBuilder.WithFormField | ( | string | key, |
| string | value ) |
Adds a form field to the request Use this when what you want to do can be accomplished on the proper IFormCollection type.
| key | |
| value |
| HttpContextBuilder PeanutButter.TestUtils.AspNetCore.Builders.HttpContextBuilder.WithFormFile | ( | string | content, |
| string | name, | ||
| string | fileName = null ) |
Adds a form file to the context.
| content | |
| name | |
| fileName |
| HttpContextBuilder PeanutButter.TestUtils.AspNetCore.Builders.HttpContextBuilder.WithItem | ( | object | key, |
| object | value ) |
Sets an Item on the context.
| key | |
| value |
| HttpContextBuilder PeanutButter.TestUtils.AspNetCore.Builders.HttpContextBuilder.WithRandomConnection | ( | ) |
Populates a random ConnectionInfo on the HttpContext.
| HttpContextBuilder PeanutButter.TestUtils.AspNetCore.Builders.HttpContextBuilder.WithRemoteAddress | ( | IPAddress | address | ) |
Sets the HttpContext.Connection.RemoteIpAddress value.
| address |
| HttpContextBuilder PeanutButter.TestUtils.AspNetCore.Builders.HttpContextBuilder.WithRemoteAddress | ( | string | ipAddress | ) |
Sets the HttpContext.Connection.RemoteIpAddress value.
| ipAddress |
| HttpContextBuilder PeanutButter.TestUtils.AspNetCore.Builders.HttpContextBuilder.WithRequest | ( | Func< HttpRequest > | requestAccessor | ) |
Sets the request accessor on the context.
| requestAccessor |
| HttpContextBuilder PeanutButter.TestUtils.AspNetCore.Builders.HttpContextBuilder.WithRequest | ( | HttpRequest | request | ) |
Sets the request on the context.
| request |
| HttpContextBuilder PeanutButter.TestUtils.AspNetCore.Builders.HttpContextBuilder.WithRequestContentType | ( | string | contentType | ) |
Sets the ContentType (and related Content-Type header) on the request.
| contentType |
| HttpContextBuilder PeanutButter.TestUtils.AspNetCore.Builders.HttpContextBuilder.WithRequestCookie | ( | string | key, |
| string | value ) |
Set a request cookie.
| key | |
| value |
| HttpContextBuilder PeanutButter.TestUtils.AspNetCore.Builders.HttpContextBuilder.WithRequestHeader | ( | string | key, |
| string | value ) |
Set a request header.
| key | |
| value |
| NotImplementedException |
| HttpContextBuilder PeanutButter.TestUtils.AspNetCore.Builders.HttpContextBuilder.WithRequestMutator | ( | Action< HttpRequest > | mutator | ) |
Modifies some aspect of the request. Use this when what you want to do can be achieved on the proper HttpRequest type.
| mutator |
| HttpContextBuilder PeanutButter.TestUtils.AspNetCore.Builders.HttpContextBuilder.WithRequestPath | ( | string | path | ) |
Sets the path on the request.
| path |
| HttpContextBuilder PeanutButter.TestUtils.AspNetCore.Builders.HttpContextBuilder.WithRequestQueryParameter | ( | string | key, |
| string | value ) |
Sets a query parameter on the request.
| key | |
| value |
| HttpContextBuilder PeanutButter.TestUtils.AspNetCore.Builders.HttpContextBuilder.WithRequestQueryParameters | ( | IDictionary< string, string > | parameters | ) |
Bulk-sets query parameters on the request.
| HttpContextBuilder PeanutButter.TestUtils.AspNetCore.Builders.HttpContextBuilder.WithRequestServices | ( | IServiceProvider | serviceProvider | ) |
Sets the RequestServices service provider for the context.
| serviceProvider |
| HttpContextBuilder PeanutButter.TestUtils.AspNetCore.Builders.HttpContextBuilder.WithResponse | ( | Func< HttpResponse > | accessor | ) |
Sets the response accessor on the context.
| accessor |
| HttpContextBuilder PeanutButter.TestUtils.AspNetCore.Builders.HttpContextBuilder.WithResponse | ( | HttpResponse | response | ) |
Sets the response on the context.
| response |
| HttpContextBuilder PeanutButter.TestUtils.AspNetCore.Builders.HttpContextBuilder.WithResponseHeader | ( | string | key, |
| string | value ) |
Set a response header.
| key | |
| value |
| NotImplementedException |
| HttpContextBuilder PeanutButter.TestUtils.AspNetCore.Builders.HttpContextBuilder.WithResponseMutator | ( | Action< HttpResponse > | mutator | ) |
Modifies some aspect of the response. Use this when what you want to do can be achieved on the proper HttpResponse type.
| mutator |
| HttpContextBuilder PeanutButter.TestUtils.AspNetCore.Builders.HttpContextBuilder.WithService< TService > | ( | Func< HttpContext, TService > | factory | ) |
Register a service factory.
| factory |
| TService |
| HttpContextBuilder PeanutButter.TestUtils.AspNetCore.Builders.HttpContextBuilder.WithService< TService > | ( | Func< TService > | factory | ) |
Register a service factory.
| factory |
| TService |
| HttpContextBuilder PeanutButter.TestUtils.AspNetCore.Builders.HttpContextBuilder.WithService< TService > | ( | TService | service | ) |
Register a service instance.
| service |
| TService |
| HttpContextBuilder PeanutButter.TestUtils.AspNetCore.Builders.HttpContextBuilder.WithServicesMutator | ( | Action< HttpContext, MinimalServiceProvider > | mutator | ) |
Open access to apply mutations to the MinimalServiceProvider, if not overridden.
| mutator |
| NotSupportedException |
| HttpContextBuilder PeanutButter.TestUtils.AspNetCore.Builders.HttpContextBuilder.WithServicesMutator | ( | Action< MinimalServiceProvider > | mutator | ) |
Open access to apply mutations to the MinimalServiceProvider, if not overridden.
| mutator |
| NotSupportedException |
| HttpContextBuilder PeanutButter.TestUtils.AspNetCore.Builders.HttpContextBuilder.WithSessionItem | ( | string | key, |
| object | value ) |
Sets an item in the HttpContext.Session.
| key | |
| value |
| HttpContextBuilder PeanutButter.TestUtils.AspNetCore.Builders.HttpContextBuilder.WithSessionItems | ( | IDictionary< string, object > | items | ) |
Sets session items on the HttpContext from the provided collection.
| items |
| ArgumentException |
| HttpContextBuilder PeanutButter.TestUtils.AspNetCore.Builders.HttpContextBuilder.WithSingletonService< TService, TImplementation > | ( | ) |
Register a singleton service.
| TService | |
| TImplementation |
| TImplementation | : | TService |
| HttpContextBuilder PeanutButter.TestUtils.AspNetCore.Builders.HttpContextBuilder.WithTransientService< TService, TImplementation > | ( | ) |
Register a transient service.
| TService | |
| TImplementation |
| TImplementation | : | TService |
| HttpContextBuilder PeanutButter.TestUtils.AspNetCore.Builders.HttpContextBuilder.WithUrl | ( | string | url | ) |
Set the full url for the request.
| url |
| HttpContextBuilder PeanutButter.TestUtils.AspNetCore.Builders.HttpContextBuilder.WithUrl | ( | Uri | uri | ) |
Set the full url for the request.
| uri |
| HttpContextBuilder PeanutButter.TestUtils.AspNetCore.Builders.HttpContextBuilder.WithUser | ( | ClaimsPrincipal | principal | ) |
Sets the user on the request.
| principal |
| HttpContextBuilder PeanutButter.TestUtils.AspNetCore.Builders.HttpContextBuilder.WithWebSockets | ( | WebSocketManager | webSocketManager | ) |
Sets the WebSockets manager on the request.
| webSocketManager |