Table of Contents

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
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 InvocationMatcher

An invocation matcher used to determine if the handler should handle an invocation.

isCatchAllHandler bool

Set 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

JSRuntimeInvocationDictionary

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

bool

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

bool

Methods

HandleAsync(JSRuntimeInvocation)

Call this to have the this handler handle the invocation.

protected virtual Task<TResult> HandleAsync(JSRuntimeInvocation invocation)

Parameters

invocation JSRuntimeInvocation

Invocation 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 TException

The 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 TResult

The type of result to pass to the callers.

.NET Foundation

Supported by the .NET Foundation.