Table of Contents

Class JSRuntimeAssertExtensions

Namespace
Bunit
Assembly
Bunit.Web.dll

Assert extensions for JSRuntimeMock.

public static class JSRuntimeAssertExtensions
Inheritance
JSRuntimeAssertExtensions
Inherited Members

Methods

ShouldBeElementReferenceTo(object?, IElement)

Verifies that an argument actualArgument passed to an JSRuntime invocation is an ElementReference to the expectedTargetElement.

public static void ShouldBeElementReferenceTo(this object? actualArgument, IElement expectedTargetElement)

Parameters

actualArgument object

object to verify.

expectedTargetElement IElement

expected targeted element.

VerifyInvoke(BunitJSInterop, string, int, string?)

Verifies that the identifier has been invoked calledTimes times.

public static IReadOnlyList<JSRuntimeInvocation> VerifyInvoke(this BunitJSInterop jsInterop, string identifier, int calledTimes, string? userMessage = null)

Parameters

jsInterop BunitJSInterop

The bUnit JSInterop to verify against.

identifier string

Identifier of invocation that should have been invoked.

calledTimes int

The number of times the invocation is expected to have been called.

userMessage string

A custom user message to display if the assertion fails.

Returns

IReadOnlyList<JSRuntimeInvocation>

The JSRuntimeInvocation.

VerifyInvoke(BunitJSInterop, string, string?)

Verifies that the identifier has been invoked one time.

public static JSRuntimeInvocation VerifyInvoke(this BunitJSInterop jsInterop, string identifier, string? userMessage = null)

Parameters

jsInterop BunitJSInterop

The bUnit JSInterop to verify against.

identifier string

Identifier of invocation that should have been invoked.

userMessage string

A custom user message to display if the assertion fails.

Returns

JSRuntimeInvocation

The JSRuntimeInvocation.

VerifyInvoke<TResult>(JSRuntimeInvocationHandlerBase<TResult>, string, int, string?)

Verifies that the identifier has been invoked calledTimes times.

public static IReadOnlyList<JSRuntimeInvocation> VerifyInvoke<TResult>(this JSRuntimeInvocationHandlerBase<TResult> handler, string identifier, int calledTimes, string? userMessage = null)

Parameters

handler JSRuntimeInvocationHandlerBase<TResult>

Handler to verify against.

identifier string

Identifier of invocation that should have been invoked.

calledTimes int

The number of times the invocation is expected to have been called.

userMessage string

A custom user message to display if the assertion fails.

Returns

IReadOnlyList<JSRuntimeInvocation>

The JSRuntimeInvocation.

Type Parameters

TResult

VerifyInvoke<TResult>(JSRuntimeInvocationHandlerBase<TResult>, string, string?)

Verifies that the identifier has been invoked one time.

public static JSRuntimeInvocation VerifyInvoke<TResult>(this JSRuntimeInvocationHandlerBase<TResult> handler, string identifier, string? userMessage = null)

Parameters

handler JSRuntimeInvocationHandlerBase<TResult>

Handler to verify against.

identifier string

Identifier of invocation that should have been invoked.

userMessage string

A custom user message to display if the assertion fails.

Returns

JSRuntimeInvocation

The JSRuntimeInvocation.

Type Parameters

TResult

VerifyNotInvoke(BunitJSInterop, string, string?)

Verifies that the identifier was never invoked on the jsInterop.

public static void VerifyNotInvoke(this BunitJSInterop jsInterop, string identifier, string? userMessage = null)

Parameters

jsInterop BunitJSInterop

The bUnit JSInterop to verify against.

identifier string

Identifier of invocation that should not have happened.

userMessage string

A custom user message to display if the assertion fails.

VerifyNotInvoke<TResult>(JSRuntimeInvocationHandlerBase<TResult>, string, string?)

Verifies that the identifier was never invoked on the handler.

public static void VerifyNotInvoke<TResult>(this JSRuntimeInvocationHandlerBase<TResult> handler, string identifier, string? userMessage = null)

Parameters

handler JSRuntimeInvocationHandlerBase<TResult>

Handler to verify against.

identifier string

Identifier of invocation that should not have happened.

userMessage string

A custom user message to display if the assertion fails.

Type Parameters

TResult
Progress Telerik

Premium sponsor: Progress Telerik.

Packt

Editorial support provided by Packt.

.NET Foundation

Supported by the .NET Foundation.