Table of Contents

Class WaitForAssertionHelper

Namespace
Bunit.Extensions.WaitForHelpers
Assembly
Bunit.Core.dll

Represents an async wait helper, that will wait for a specified time for an assertion to pass.

public class WaitForAssertionHelper : WaitForHelper<object?>, IDisposable
Inheritance
WaitForAssertionHelper
Implements
Inherited Members
Extension Methods

Constructors

WaitForAssertionHelper(IRenderedFragmentBase, Action, TimeSpan?)

Initializes a new instance of the WaitForAssertionHelper class, which will until the provided assertion passes (i.e. does not throw an exception), or the timeout is reached (default is one second).

The assertion is attempted initially, and then each time the renderedFragment renders.

public WaitForAssertionHelper(IRenderedFragmentBase renderedFragment, Action assertion, TimeSpan? timeout = null)

Parameters

renderedFragment IRenderedFragmentBase

The rendered fragment to wait for renders from and assert against.

assertion Action

The verification or assertion to perform.

timeout TimeSpan?

The maximum time to attempt the verification.

Remarks

If a debugger is attached the timeout is set to InfiniteTimeSpan, giving the possibility to debug without the timeout triggering.

Properties

StopWaitingOnCheckException

Gets a value indicating whether to continue waiting if the wait condition checker throws.

protected override bool StopWaitingOnCheckException { get; }

Property Value

bool

TimeoutErrorMessage

Gets the error message passed to the user when the wait for helper times out.

protected override string? TimeoutErrorMessage { get; }

Property Value

string
Progress Telerik

Premium sponsor: Progress Telerik.

Packt

Editorial support provided by Packt.

.NET Foundation

Supported by the .NET Foundation.