Class JSRuntimeInvocationHandlerBase<TResult>
- Namespace
- Bunit
- Assembly
- Bunit.Web.dll
Represents an invocation handler for JSRuntimeInvocation instances.
public abstract class JSRuntimeInvocationHandlerBase<TResult>
Type Parameters
TResult
- Inheritance
-
JSRuntimeInvocationHandlerBase<TResult>
- Derived
-
JSRuntimeInvocationHandler<TResult>
- Inherited Members
- Extension Methods
Constructors
JSRuntimeInvocationHandlerBase(InvocationMatcher, bool)
Initializes a new instance of the JSRuntimeInvocationHandlerBase<TResult> class.
protected JSRuntimeInvocationHandlerBase(InvocationMatcher matcher, bool isCatchAllHandler)
Parameters
matcher
InvocationMatcherAn invocation matcher used to determine if the handler should handle an invocation.
isCatchAllHandler
boolSet to true if this handler is a catch all handler, that should only be used if there are no other non-catch all handlers available.
Properties
Invocations
Gets the invocations that this JSRuntimeInvocationHandler<TResult> has matched with.
public JSRuntimeInvocationDictionary Invocations { get; }
Property Value
IsCatchAllHandler
Gets a value indicating whether this handler is considered a catch all handler for invocations with TResult
as the return type.
public bool IsCatchAllHandler { get; }
Property Value
IsVoidResultHandler
Gets a value indicating whether this handler is set up to handle calls to InvokeVoidAsync(string, object[])
.
public virtual bool IsVoidResultHandler { get; }
Property Value
Methods
HandleAsync(JSRuntimeInvocation)
Call this to have the this handler handle the invocation
.
protected virtual Task<TResult> HandleAsync(JSRuntimeInvocation invocation)
Parameters
invocation
JSRuntimeInvocationInvocation to handle.
Returns
- Task<TResult>
Remarks
Note to implementors: Always call the HandleAsync(JSRuntimeInvocation) method when overriding it in a sub class. It will make sure the invocation is correctly registered in the Invocations dictionary.
SetCanceledBase()
Marks the Task<TResult> that invocations will receive as canceled.
protected void SetCanceledBase()
SetExceptionBase<TException>(TException)
Sets the TException
exception that invocations will receive.
protected void SetExceptionBase<TException>(TException exception) where TException : Exception
Parameters
exception
TExceptionThe type of exception to pass to the callers.
Type Parameters
TException
SetResultBase(TResult)
Sets the TResult
result that invocations will receive.
protected void SetResultBase(TResult result)
Parameters
result
TResultThe type of result to pass to the callers.