Table of Contents

Interface IEventFilterApplier

Namespace
Akka.TestKit
Assembly
Akka.TestKit.dll

TBD

public interface IEventFilterApplier

Properties

And

Let's you chain more filters together. Similar to Akka JVM's filterEvents

EventFilterFactory And { get; }

Property Value

EventFilterFactory

Methods

Expect(int, Action, CancellationToken)

Executes action and expects the specified number of events to be logged during the execution. This method fails and throws an exception if more events than expected are logged, or if a timeout occurs. The timeout is taken from the config value "akka.test.filter-leeway", see TestEventFilterLeeway.

void Expect(int expectedCount, Action action, CancellationToken cancellationToken = default)

Parameters

expectedCount int

The expected number of events

action Action

The action.

cancellationToken CancellationToken

Expect(int, TimeSpan, Action, CancellationToken)

Executes action and expects the specified number of events to be logged during the execution. This method fails and throws an exception if more events than expected are logged, or if a timeout occurs. The timeout is taken from the config value "akka.test.filter-leeway", see TestEventFilterLeeway.

void Expect(int expectedCount, TimeSpan timeout, Action action, CancellationToken cancellationToken = default)

Parameters

expectedCount int

The expected number of events

timeout TimeSpan

The time to wait for log events after executing action

action Action

The action.

cancellationToken CancellationToken

ExpectAsync(int, Func<Task>, TimeSpan?, CancellationToken)

Executes actionAsync task and expects the specified number of events to be logged during the execution. This method fails and throws an exception if more events than expected are logged, or if a timeout occurs. The timeout is taken from the config value "akka.test.filter-leeway", see TestEventFilterLeeway.

Task ExpectAsync(int expectedCount, Func<Task> actionAsync, TimeSpan? timeout, CancellationToken cancellationToken = default)

Parameters

expectedCount int

The expected number of events

actionAsync Func<Task>

The async action.

timeout TimeSpan?
cancellationToken CancellationToken

Returns

Task

ExpectAsync(int, Func<Task>, CancellationToken)

Executes actionAsync task and expects the specified number of events to be logged during the execution. This method fails and throws an exception if more events than expected are logged, or if a timeout occurs. The timeout is taken from the config value "akka.test.filter-leeway", see TestEventFilterLeeway.

Task ExpectAsync(int expectedCount, Func<Task> actionAsync, CancellationToken cancellationToken = default)

Parameters

expectedCount int

The expected number of events

actionAsync Func<Task>

The async action.

cancellationToken CancellationToken

Returns

Task

ExpectAsync(int, TimeSpan, Action, CancellationToken)

[Obsolete("Use ExpectAsync<T>(expectedCount, TimeSpan, Func<Task<T>>) instead. This method only exists to support backwards compatibility as of Akka.NET v1.5.")]
Task ExpectAsync(int expectedCount, TimeSpan timeout, Action action, CancellationToken cancellationToken = default)

Parameters

expectedCount int
timeout TimeSpan
action Action
cancellationToken CancellationToken

Returns

Task

ExpectAsync(int, TimeSpan, Func<Task>, CancellationToken)

Executes action and expects the specified number of events to be logged during the execution. This method fails and throws an exception if more events than expected are logged, or if a timeout occurs. The timeout is taken from the config value "akka.test.filter-leeway", see TestEventFilterLeeway.

Task ExpectAsync(int expectedCount, TimeSpan timeout, Func<Task> action, CancellationToken cancellationToken = default)

Parameters

expectedCount int

The expected number of events

timeout TimeSpan

The time to wait for log events after executing action

action Func<Task>

The action.

cancellationToken CancellationToken

Returns

Task

ExpectAsync<T>(int, Func<Task<T>>, CancellationToken)

Executes func and expects the specified number of events to be logged during the execution. This function fails and throws an exception if more events than expected are logged, or if a timeout occurs. The timeout is taken from the config value "akka.test.filter-leeway", see TestEventFilterLeeway. Note: func might not get awaited.

Task<T> ExpectAsync<T>(int expectedCount, Func<Task<T>> func, CancellationToken cancellationToken = default)

Parameters

expectedCount int

The expected number of events

func Func<Task<T>>

The function.

cancellationToken CancellationToken

Returns

Task<T>

The returned value from func.

Type Parameters

T

The return value of the function

ExpectAsync<T>(int, TimeSpan, Func<Task<T>>, CancellationToken)

Executes func and expects the specified number of events to be logged during the execution. This function fails and throws an exception if more events than expected are logged, or if a timeout occurs. The timeout is taken from the config value "akka.test.filter-leeway", see TestEventFilterLeeway.

Task<T> ExpectAsync<T>(int expectedCount, TimeSpan timeout, Func<Task<T>> func, CancellationToken cancellationToken = default)

Parameters

expectedCount int

The expected number of events

timeout TimeSpan

The time to wait for log events after executing func

func Func<Task<T>>

The function.

cancellationToken CancellationToken

Returns

Task<T>

The returned value from func.

Type Parameters

T

The return value of the function

ExpectOne(Action, CancellationToken)

Executes action and expects one event to be logged during the execution. This method fails and throws an exception if more than one event is logged, or if a timeout occurs. The timeout is taken from the config value "akka.test.filter-leeway", see TestEventFilterLeeway.

void ExpectOne(Action action, CancellationToken cancellationToken = default)

Parameters

action Action

The action.

cancellationToken CancellationToken

ExpectOne(TimeSpan, Action, CancellationToken)

Executes action and expects one event to be logged during the execution. This method fails and throws an exception if more than one event is logged, or if a timeout occurs.

void ExpectOne(TimeSpan timeout, Action action, CancellationToken cancellationToken = default)

Parameters

timeout TimeSpan

The time to wait for a log event after executing action

action Action

The action.

cancellationToken CancellationToken

ExpectOneAsync(Action, CancellationToken)

[Obsolete("Only for backwards compat. Use ExpectOneAsync(Func<Task>, CancellationToken) instead beginning in Akka.NET v1.5")]
Task ExpectOneAsync(Action action, CancellationToken cancellationToken = default)

Parameters

action Action
cancellationToken CancellationToken

Returns

Task

ExpectOneAsync(Func<Task>, CancellationToken)

Executes actionAsync and expects one event to be logged during the execution. This method fails and throws an exception if more than one event is logged, or if a timeout occurs. The timeout is taken from the config value "akka.test.filter-leeway", see TestEventFilterLeeway.

Task ExpectOneAsync(Func<Task> actionAsync, CancellationToken cancellationToken = default)

Parameters

actionAsync Func<Task>

The action.

cancellationToken CancellationToken

Returns

Task

ExpectOneAsync(TimeSpan, Func<Task>, CancellationToken)

Executes action and expects one event to be logged during the execution. This method fails and throws an exception if more than one event is logged, or if a timeout occurs.

Task ExpectOneAsync(TimeSpan timeout, Func<Task> action, CancellationToken cancellationToken = default)

Parameters

timeout TimeSpan

The time to wait for a log event after executing action

action Func<Task>

The action.

cancellationToken CancellationToken

Returns

Task

ExpectOneAsync<T>(Func<Task<T>>, CancellationToken)

Executes func and expects one event to be logged during the execution. This function fails and throws an exception if more than one event is logged, or if a timeout occurs. The timeout is taken from the config value "akka.test.filter-leeway", see TestEventFilterLeeway.

Task<T> ExpectOneAsync<T>(Func<Task<T>> func, CancellationToken cancellationToken = default)

Parameters

func Func<Task<T>>

The function.

cancellationToken CancellationToken

Returns

Task<T>

The returned value from func.

Type Parameters

T

The return value of the function

ExpectOneAsync<T>(TimeSpan, Func<Task<T>>, CancellationToken)

Executes func and expects one event to be logged during the execution. This function fails and throws an exception if more than one event is logged, or if a timeout occurs.

Task<T> ExpectOneAsync<T>(TimeSpan timeout, Func<Task<T>> func, CancellationToken cancellationToken = default)

Parameters

timeout TimeSpan

The time to wait for a log event after executing func

func Func<Task<T>>

The function.

cancellationToken CancellationToken

Returns

Task<T>

The returned value from func.

Type Parameters

T

The return value of the function

ExpectOne<T>(Func<T>, CancellationToken)

Executes func and expects one event to be logged during the execution. This function fails and throws an exception if more than one event is logged, or if a timeout occurs. The timeout is taken from the config value "akka.test.filter-leeway", see TestEventFilterLeeway.

T ExpectOne<T>(Func<T> func, CancellationToken cancellationToken = default)

Parameters

func Func<T>

The function.

cancellationToken CancellationToken

Returns

T

The returned value from func.

Type Parameters

T

The return value of the function

ExpectOne<T>(TimeSpan, Func<T>, CancellationToken)

Executes func and expects one event to be logged during the execution. This function fails and throws an exception if more than one event is logged, or if a timeout occurs.

T ExpectOne<T>(TimeSpan timeout, Func<T> func, CancellationToken cancellationToken = default)

Parameters

timeout TimeSpan

The time to wait for a log event after executing func

func Func<T>

The function.

cancellationToken CancellationToken

Returns

T

The returned value from func.

Type Parameters

T

The return value of the function

Expect<T>(int, Func<T>, CancellationToken)

Executes func and expects the specified number of events to be logged during the execution. This function fails and throws an exception if more events than expected are logged, or if a timeout occurs. The timeout is taken from the config value "akka.test.filter-leeway", see TestEventFilterLeeway.

T Expect<T>(int expectedCount, Func<T> func, CancellationToken cancellationToken = default)

Parameters

expectedCount int

The expected number of events

func Func<T>

The function.

cancellationToken CancellationToken

Returns

T

The returned value from func.

Type Parameters

T

The return value of the function

Expect<T>(int, TimeSpan, Func<T>, CancellationToken)

Executes func and expects the specified number of events to be logged during the execution. This function fails and throws an exception if more events than expected are logged, or if a timeout occurs. The timeout is taken from the config value "akka.test.filter-leeway", see TestEventFilterLeeway.

T Expect<T>(int expectedCount, TimeSpan timeout, Func<T> func, CancellationToken cancellationToken = default)

Parameters

expectedCount int

The expected number of events

timeout TimeSpan

The time to wait for log events after executing func

func Func<T>

The function.

cancellationToken CancellationToken

Returns

T

The returned value from func.

Type Parameters

T

The return value of the function

Mute()

Prevents events from being logged from now on. To allow events to be logged again, call Unmute() on the returned object.

var filter = EventFilter.Debug().Mute();
...
filter.Unmute();
You may also use it like this:
using(EventFilter.Debug().Mute())
{
   ...
}
IUnmutableFilter Mute()

Returns

IUnmutableFilter

TBD

Mute(Action, CancellationToken)

Executes action and prevent events from being logged during the execution.

void Mute(Action action, CancellationToken cancellationToken = default)

Parameters

action Action

The function.

cancellationToken CancellationToken

MuteAsync(Action, CancellationToken)

[Obsolete("Use MuteAsync(Func<Task>) instead. This method only exists for backwards compatibility as of Akka.NET v1.5.0.")]
Task MuteAsync(Action action, CancellationToken cancellationToken = default)

Parameters

action Action
cancellationToken CancellationToken

Returns

Task

MuteAsync(Func<Task>, CancellationToken)

Executes action and prevent events from being logged during the execution.

Task MuteAsync(Func<Task> action, CancellationToken cancellationToken = default)

Parameters

action Func<Task>

The function.

cancellationToken CancellationToken

Returns

Task

The returned value from action.

MuteAsync<T>(Func<Task<T>>, CancellationToken)

Executes func and prevent events from being logged during the execution.

Task<T> MuteAsync<T>(Func<Task<T>> func, CancellationToken cancellationToken = default)

Parameters

func Func<Task<T>>

The function.

cancellationToken CancellationToken

Returns

Task<T>

The returned value from func.

Type Parameters

T

The return value of the function

Mute<T>(Func<T>, CancellationToken)

Executes func and prevent events from being logged during the execution.

T Mute<T>(Func<T> func, CancellationToken cancellationToken = default)

Parameters

func Func<T>

The function.

cancellationToken CancellationToken

Returns

T

The returned value from func.

Type Parameters

T

The return value of the function