PeanutButter
Loading...
Searching...
No Matches
PeanutButter.TestUtils.AspNetCore.Utils.RequestDelegateTestArena Class Reference

Sets up the useful bits for testing an asp.net middleware class - use this to easily set up the context and next parameters for InvokeAsync. More...

Public Member Functions

 RequestDelegateTestArena ()
 Construct a test arena with no custom logic in the delegate and no mutations to the http context.
 RequestDelegateTestArena (Action< HttpContext > delegateLogic)
 Create the test arena with custom delegate logic and no http context mutations.
 RequestDelegateTestArena (Func< HttpContext, Task > delegateLogic)
 Create the test arena with custom delegate logic and no http context mutations.
 RequestDelegateTestArena (Action< HttpContext > logic, Action< HttpContextBuilder > httpContextMutator)
 Constructs a RequestDelegateTestArena with the provided synchronous http logic and context mutator.
 RequestDelegateTestArena (Func< HttpContext, Task > logic, Action< HttpContextBuilder > httpContextMutator)
 Create the test arena with the provided delegate logic and http context mutations.
 RequestDelegateTestArena (Func< HttpContext, Task > logic, HttpContext httpContext)
 Construct with the provided logic and context.
void Deconstruct (out HttpContext ctx, out RequestDelegate next)
 Deconstruct into a tuple, eg var (ctx, next) = new RequestDelegateTestArena();.

Static Public Attributes

const string METADATA_KEY_CALL_ARGS = "__callargs__"
 The key used to hold the call history for the delegate in PB metadata.

Properties

RequestDelegate Delegate [get]
 The delegate that is generated for your test.
HttpContext HttpContext [get, set]
 The HttpContext (or use this to set your own)

Detailed Description

Sets up the useful bits for testing an asp.net middleware class - use this to easily set up the context and next parameters for InvokeAsync.

Constructor & Destructor Documentation

◆ RequestDelegateTestArena() [1/5]

PeanutButter.TestUtils.AspNetCore.Utils.RequestDelegateTestArena.RequestDelegateTestArena ( Action< HttpContext > delegateLogic)

Create the test arena with custom delegate logic and no http context mutations.

Parameters
delegateLogic

◆ RequestDelegateTestArena() [2/5]

PeanutButter.TestUtils.AspNetCore.Utils.RequestDelegateTestArena.RequestDelegateTestArena ( Func< HttpContext, Task > delegateLogic)

Create the test arena with custom delegate logic and no http context mutations.

Parameters
delegateLogic

◆ RequestDelegateTestArena() [3/5]

PeanutButter.TestUtils.AspNetCore.Utils.RequestDelegateTestArena.RequestDelegateTestArena ( Action< HttpContext > logic,
Action< HttpContextBuilder > httpContextMutator )

Constructs a RequestDelegateTestArena with the provided synchronous http logic and context mutator.

Parameters
logic
httpContextMutator

◆ RequestDelegateTestArena() [4/5]

PeanutButter.TestUtils.AspNetCore.Utils.RequestDelegateTestArena.RequestDelegateTestArena ( Func< HttpContext, Task > logic,
Action< HttpContextBuilder > httpContextMutator )

Create the test arena with the provided delegate logic and http context mutations.

Parameters
logic
httpContextMutator

◆ RequestDelegateTestArena() [5/5]

PeanutButter.TestUtils.AspNetCore.Utils.RequestDelegateTestArena.RequestDelegateTestArena ( Func< HttpContext, Task > logic,
HttpContext httpContext )

Construct with the provided logic and context.

Parameters
logic
httpContext
Exceptions
NotImplementedException

Member Function Documentation

◆ Deconstruct()

void PeanutButter.TestUtils.AspNetCore.Utils.RequestDelegateTestArena.Deconstruct ( out HttpContext ctx,
out RequestDelegate next )

Deconstruct into a tuple, eg var (ctx, next) = new RequestDelegateTestArena();.

Parameters
ctx
next

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