Search Results for

    Show / Hide Table of Contents

    Class TestKitBase

    Unless you're creating a TestKit for a specific test framework, you should probably not inherit directly from this class.

    Inheritance
    object
    TestKitBase
    MultiNodeSpec
    TestProbe
    TestKit
    TestKit
    Implements
    IActorRefFactory
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Akka.TestKit
    Assembly: Akka.TestKit.dll
    Syntax
    public abstract class TestKitBase : IActorRefFactory

    Constructors

    | Edit this page View Source

    TestKitBase(ITestKitAssertions, ActorSystem, ActorSystemSetup, string, string)

    Declaration
    protected TestKitBase(ITestKitAssertions assertions, ActorSystem system, ActorSystemSetup config, string actorSystemName, string testActorName)
    Parameters
    Type Name Description
    ITestKitAssertions assertions
    ActorSystem system
    ActorSystemSetup config
    string actorSystemName
    string testActorName
    | Edit this page View Source

    TestKitBase(ITestKitAssertions, ActorSystem, string)

    Create a new instance of the TestKitBase class. If no system is passed in, a new system with DefaultConfig will be created.

    Declaration
    protected TestKitBase(ITestKitAssertions assertions, ActorSystem system = null, string testActorName = null)
    Parameters
    Type Name Description
    ITestKitAssertions assertions

    The framework-specific assertion tools.

    ActorSystem system

    Optional: The actor system.

    string testActorName

    Optional: The name of the TestActor.

    Exceptions
    Type Condition
    ArgumentNullException

    This exception is thrown when the given assertions is undefined.

    | Edit this page View Source

    TestKitBase(ITestKitAssertions, ActorSystemSetup, string, string)

    Create a new instance of the TestKitBase class. A new system with the specified configuration will be created.

    Declaration
    protected TestKitBase(ITestKitAssertions assertions, ActorSystemSetup setup, string actorSystemName = null, string testActorName = null)
    Parameters
    Type Name Description
    ITestKitAssertions assertions

    The set of assertions used by the TestKit.

    ActorSystemSetup setup

    The ActorSystemSetup to use for the configuring the system.

    string actorSystemName

    Optional: the name of the ActorSystem.

    string testActorName

    Optional: the name of the TestActor.

    Exceptions
    Type Condition
    ArgumentNullException

    This exception is thrown when the given assertions is undefined.

    | Edit this page View Source

    TestKitBase(ITestKitAssertions, Config, string, string)

    Create a new instance of the TestKitBase class. A new system with the specified configuration will be created.

    Declaration
    protected TestKitBase(ITestKitAssertions assertions, Config config, string actorSystemName = null, string testActorName = null)
    Parameters
    Type Name Description
    ITestKitAssertions assertions

    The set of assertions used by the TestKit.

    Config config

    The configuration to use for the system.

    string actorSystemName

    Optional: the name of the ActorSystem.

    string testActorName

    Optional: the name of the TestActor.

    Exceptions
    Type Condition
    ArgumentNullException

    This exception is thrown when the given assertions is undefined.

    Properties

    | Edit this page View Source

    DefaultConfig

    The default TestKit configuration.

    Declaration
    public static Config DefaultConfig { get; }
    Property Value
    Type Description
    Config
    | Edit this page View Source

    EventFilter

    Filter LogEvent sent to the system's EventStream. In order to be able to filter the log the special logger TestEventListener must be installed using the config

    akka.loggers = ["Akka.TestKit.TestEventListener, Akka.TestKit"]

    It is installed by default in testkit.

    Declaration
    public EventFilterFactory EventFilter { get; }
    Property Value
    Type Description
    EventFilterFactory
    | Edit this page View Source

    FullDebugConfig

    A full debugging configuration with all log settings enabled.

    Declaration
    public static Config FullDebugConfig { get; }
    Property Value
    Type Description
    Config
    | Edit this page View Source

    HasMessages

    Returns true if messages are available.

    Declaration
    public bool HasMessages { get; }
    Property Value
    Type Description
    bool

    true if messages are available; otherwise, false.

    | Edit this page View Source

    LastMessage

    The last message received by the TestActor.

    Declaration
    public object LastMessage { get; }
    Property Value
    Type Description
    object
    | Edit this page View Source

    LastSender

    The last IActorRef to send a message to the TestActor.

    Declaration
    public IActorRef LastSender { get; }
    Property Value
    Type Description
    IActorRef
    | Edit this page View Source

    Log

    The built-in ILoggingAdapter used by Sys.

    Declaration
    public ILoggingAdapter Log { get; }
    Property Value
    Type Description
    ILoggingAdapter
    | Edit this page View Source

    Now

    The current time.

    Declaration
    public static TimeSpan Now { get; }
    Property Value
    Type Description
    TimeSpan
    | Edit this page View Source

    Remaining

    Retrieves the time remaining for execution of the innermost enclosing Within block.

    The returned value is always finite.
    Declaration
    public TimeSpan Remaining { get; }
    Property Value
    Type Description
    TimeSpan
    Exceptions
    Type Condition
    InvalidOperationException

    This exception is thrown when called from outside of within.

    | Edit this page View Source

    RemainingOrDefault

    Retrieves the time remaining for execution of the innermost enclosing Within block. If missing that, then it returns the properly dilated default for this case from settings (key: "akka.test.single-expect-default").

    The returned value is always finite.
    Declaration
    public TimeSpan RemainingOrDefault { get; }
    Property Value
    Type Description
    TimeSpan
    | Edit this page View Source

    Sys

    The ActorSystem that is recreated and used for each test.

    Declaration
    public ActorSystem Sys { get; }
    Property Value
    Type Description
    ActorSystem
    | Edit this page View Source

    TestActor

    The default TestActor. The actor can be controlled by sending it special control messages, see TestActor.SetIgnore, TestActor.Watch, TestActor.Unwatch. You can also install an AutoPilot to drive the actor, see SetAutoPilot(AutoPilot). All other messages are forwarded to the queue and can be retrieved with Receive and the ExpectMsg overloads.

    Declaration
    public IActorRef TestActor { get; }
    Property Value
    Type Description
    IActorRef
    | Edit this page View Source

    TestKitSettings

    The settings for the testkit.

    Declaration
    public TestKitSettings TestKitSettings { get; }
    Property Value
    Type Description
    TestKitSettings

    Methods

    | Edit this page View Source

    ActorOf(Props)

    Create a new actor as child of Sys.

    Declaration
    public IActorRef ActorOf(Props props)
    Parameters
    Type Name Description
    Props props

    The props configuration object

    Returns
    Type Description
    IActorRef

    TBD

    | Edit this page View Source

    ActorOf(Props, string)

    Create a new actor as child of Sys.

    Declaration
    public IActorRef ActorOf(Props props, string name)
    Parameters
    Type Name Description
    Props props

    The props configuration object

    string name

    The name of the actor.

    Returns
    Type Description
    IActorRef

    TBD

    | Edit this page View Source

    ActorOf(Action<IActorDsl, IActorContext>, string)

    Creates a new actor by defining the behavior inside the configure action.

    ActorOf(c =>
    {
        c.Receive<string>((msg, ctx) => ctx.Sender.Tell("Hello " + msg));
    });
    Declaration
    public IActorRef ActorOf(Action<IActorDsl, IActorContext> configure, string name = null)
    Parameters
    Type Name Description
    Action<IActorDsl, IActorContext> configure

    An action that configures the actor's behavior.

    string name

    Optional: The name of the actor.

    Returns
    Type Description
    IActorRef

    TBD

    | Edit this page View Source

    ActorOf(Action<IActorDsl>, string)

    Creates a new actor by defining the behavior inside the configure action.

    ActorOf(c =>
    {
        c.Receive<string>((msg, ctx) => ctx.Sender.Tell("Hello " + msg));
    });
    Declaration
    public IActorRef ActorOf(Action<IActorDsl> configure, string name = null)
    Parameters
    Type Name Description
    Action<IActorDsl> configure

    An action that configures the actor's behavior.

    string name

    Optional: The name of the actor.

    Returns
    Type Description
    IActorRef

    TBD

    | Edit this page View Source

    ActorOfAsTestActorRef<TActor>(IActorRef, string)

    Create a new actor as child of the specified supervisor and returns it as TestActorRef<TActor> to enable access to the underlying actor instance via UnderlyingActor.

    Declaration
    public TestActorRef<TActor> ActorOfAsTestActorRef<TActor>(IActorRef supervisor, string name = null) where TActor : ActorBase, new()
    Parameters
    Type Name Description
    IActorRef supervisor

    The supervisor

    string name

    Optional: The name.

    Returns
    Type Description
    TestActorRef<TActor>

    TBD

    Type Parameters
    Name Description
    TActor

    The type of the actor. It must have a parameterless public constructor

    | Edit this page View Source

    ActorOfAsTestActorRef<TActor>(Props, IActorRef, string)

    Create a new actor as child of specified supervisor and returns it as TestActorRef<TActor> to enable access to the underlying actor instance via UnderlyingActor.

    Declaration
    public TestActorRef<TActor> ActorOfAsTestActorRef<TActor>(Props props, IActorRef supervisor, string name = null) where TActor : ActorBase
    Parameters
    Type Name Description
    Props props

    The Props object

    IActorRef supervisor

    The supervisor

    string name

    Optional: The name.

    Returns
    Type Description
    TestActorRef<TActor>

    TBD

    Type Parameters
    Name Description
    TActor

    The type of the actor. It must have a parameterless public constructor

    | Edit this page View Source

    ActorOfAsTestActorRef<TActor>(Props, string)

    Create a new actor as child of Sys and returns it as TestActorRef<TActor> to enable access to the underlying actor instance via UnderlyingActor.

    Declaration
    public TestActorRef<TActor> ActorOfAsTestActorRef<TActor>(Props props, string name = null) where TActor : ActorBase
    Parameters
    Type Name Description
    Props props

    The Props object

    string name

    Optional: The name.

    Returns
    Type Description
    TestActorRef<TActor>

    TBD

    Type Parameters
    Name Description
    TActor

    The type of the actor. It must have a parameterless public constructor

    | Edit this page View Source

    ActorOfAsTestActorRef<TActor>(Expression<Func<TActor>>, IActorRef, string)

    Create a new actor as child of the specified supervisor and returns it as TestActorRef<TActor> to enable access to the underlying actor instance via UnderlyingActor. Uses an expression that calls the constructor of TActor.

    ActorOf<MyActor>(()=>new MyActor("value", 4711), "test-actor")
    Declaration
    public TestActorRef<TActor> ActorOfAsTestActorRef<TActor>(Expression<Func<TActor>> factory, IActorRef supervisor, string name = null) where TActor : ActorBase
    Parameters
    Type Name Description
    Expression<Func<TActor>> factory

    An expression that calls the constructor of TActor

    IActorRef supervisor

    The supervisor

    string name

    Optional: The name.

    Returns
    Type Description
    TestActorRef<TActor>

    TBD

    Type Parameters
    Name Description
    TActor

    The type of the actor.

    | Edit this page View Source

    ActorOfAsTestActorRef<TActor>(Expression<Func<TActor>>, string)

    Create a new actor as child of Sys and returns it as TestActorRef<TActor> to enable access to the underlying actor instance via UnderlyingActor. Uses an expression that calls the constructor of TActor.

    ActorOf<MyActor>(()=>new MyActor("value", 4711), "test-actor")
    Declaration
    public TestActorRef<TActor> ActorOfAsTestActorRef<TActor>(Expression<Func<TActor>> factory, string name = null) where TActor : ActorBase
    Parameters
    Type Name Description
    Expression<Func<TActor>> factory

    An expression that calls the constructor of TActor

    string name

    Optional: The name.

    Returns
    Type Description
    TestActorRef<TActor>

    TBD

    Type Parameters
    Name Description
    TActor

    The type of the actor.

    | Edit this page View Source

    ActorOfAsTestActorRef<TActor>(string)

    Create a new actor as child of Sys and returns it as TestActorRef<TActor> to enable access to the underlying actor instance via UnderlyingActor.

    Declaration
    public TestActorRef<TActor> ActorOfAsTestActorRef<TActor>(string name = null) where TActor : ActorBase, new()
    Parameters
    Type Name Description
    string name

    Optional: The name.

    Returns
    Type Description
    TestActorRef<TActor>

    TBD

    Type Parameters
    Name Description
    TActor

    The type of the actor. It must have a parameterless public constructor

    | Edit this page View Source

    ActorOfAsTestFSMRef<TFsmActor, TState, TData>(IActorRef, string, bool)

    Create a new FSM<TState, TData> as child of the specified supervisor and returns it as TestFSMRef<TActor, TState, TData> to enable inspecting and modifying the FSM directly. TFsmActor must have a public parameterless constructor.

    Declaration
    public TestFSMRef<TFsmActor, TState, TData> ActorOfAsTestFSMRef<TFsmActor, TState, TData>(IActorRef supervisor, string name = null, bool withLogging = false) where TFsmActor : FSM<TState, TData>, new()
    Parameters
    Type Name Description
    IActorRef supervisor

    The supervisor

    string name

    Optional: The name.

    bool withLogging

    Optional: If set to true logs state changes of the FSM as Debug messages. Default is false.

    Returns
    Type Description
    TestFSMRef<TFsmActor, TState, TData>

    TBD

    Type Parameters
    Name Description
    TFsmActor

    The type of the actor. It must have a parameterless public constructor

    TState

    The type of state name

    TData

    The type of state data

    | Edit this page View Source

    ActorOfAsTestFSMRef<TFsmActor, TState, TData>(Props, IActorRef, string, bool)

    Create a new FSM<TState, TData> as child of the specified supervisor and returns it as TestFSMRef<TActor, TState, TData> to enable inspecting and modifying the FSM directly.

    Declaration
    public TestFSMRef<TFsmActor, TState, TData> ActorOfAsTestFSMRef<TFsmActor, TState, TData>(Props props, IActorRef supervisor, string name = null, bool withLogging = false) where TFsmActor : FSM<TState, TData>
    Parameters
    Type Name Description
    Props props

    The Props object

    IActorRef supervisor

    The supervisor

    string name

    Optional: The name.

    bool withLogging

    Optional: If set to true logs state changes of the FSM as Debug messages. Default is false.

    Returns
    Type Description
    TestFSMRef<TFsmActor, TState, TData>

    TBD

    Type Parameters
    Name Description
    TFsmActor

    The type of the actor. It must be a FSM<TState, TData>

    TState

    The type of state name

    TData

    The type of state data

    | Edit this page View Source

    ActorOfAsTestFSMRef<TFsmActor, TState, TData>(Props, string, bool)

    Create a new FSM<TState, TData> as child of Sys and returns it as TestFSMRef<TActor, TState, TData> to enable inspecting and modifying the FSM directly.

    Declaration
    public TestFSMRef<TFsmActor, TState, TData> ActorOfAsTestFSMRef<TFsmActor, TState, TData>(Props props, string name = null, bool withLogging = false) where TFsmActor : FSM<TState, TData>
    Parameters
    Type Name Description
    Props props

    The Props object

    string name

    Optional: The name.

    bool withLogging

    Optional: If set to true logs state changes of the FSM as Debug messages. Default is false.

    Returns
    Type Description
    TestFSMRef<TFsmActor, TState, TData>

    TBD

    Type Parameters
    Name Description
    TFsmActor

    The type of the actor. It must be a FSM<TState, TData> and have a public parameterless constructor

    TState

    The type of state name

    TData

    The type of state data

    | Edit this page View Source

    ActorOfAsTestFSMRef<TFsmActor, TState, TData>(Expression<Func<TFsmActor>>, IActorRef, string, bool)

    Create a new FSM<TState, TData> as child of the specified supervisor and returns it as TestFSMRef<TActor, TState, TData> to enable inspecting and modifying the FSM directly. Uses an expression that calls the constructor of TFsmActor.

    Declaration
    public TestFSMRef<TFsmActor, TState, TData> ActorOfAsTestFSMRef<TFsmActor, TState, TData>(Expression<Func<TFsmActor>> factory, IActorRef supervisor, string name = null, bool withLogging = false) where TFsmActor : FSM<TState, TData>
    Parameters
    Type Name Description
    Expression<Func<TFsmActor>> factory

    An expression that calls the constructor of TFsmActor

    IActorRef supervisor

    The supervisor

    string name

    Optional: The name.

    bool withLogging

    Optional: If set to true logs state changes of the FSM as Debug messages. Default is false.

    Returns
    Type Description
    TestFSMRef<TFsmActor, TState, TData>

    TBD

    Type Parameters
    Name Description
    TFsmActor

    The type of the actor.

    TState

    The type of state name

    TData

    The type of state data

    | Edit this page View Source

    ActorOfAsTestFSMRef<TFsmActor, TState, TData>(Expression<Func<TFsmActor>>, string, bool)

    Create a new FSM<TState, TData> as child of Sys and returns it as TestFSMRef<TActor, TState, TData> to enable inspecting and modifying the FSM directly. Uses an expression that calls the constructor of TFsmActor.

    Declaration
    public TestFSMRef<TFsmActor, TState, TData> ActorOfAsTestFSMRef<TFsmActor, TState, TData>(Expression<Func<TFsmActor>> factory, string name = null, bool withLogging = false) where TFsmActor : FSM<TState, TData>
    Parameters
    Type Name Description
    Expression<Func<TFsmActor>> factory

    An expression that calls the constructor of TFsmActor

    string name

    Optional: The name.

    bool withLogging

    Optional: If set to true logs state changes of the FSM as Debug messages. Default is false.

    Returns
    Type Description
    TestFSMRef<TFsmActor, TState, TData>

    TBD

    Type Parameters
    Name Description
    TFsmActor

    The type of the actor.

    TState

    The type of state name

    TData

    The type of state data

    | Edit this page View Source

    ActorOfAsTestFSMRef<TFsmActor, TState, TData>(string, bool)

    Create a new FSM<TState, TData> as child of Sys and returns it as TestFSMRef<TActor, TState, TData> to enable inspecting and modifying the FSM directly. TFsmActor must have a public parameterless constructor.

    Declaration
    public TestFSMRef<TFsmActor, TState, TData> ActorOfAsTestFSMRef<TFsmActor, TState, TData>(string name = null, bool withLogging = false) where TFsmActor : FSM<TState, TData>, new()
    Parameters
    Type Name Description
    string name

    Optional: The name.

    bool withLogging

    Optional: If set to true logs state changes of the FSM as Debug messages. Default is false.

    Returns
    Type Description
    TestFSMRef<TFsmActor, TState, TData>

    TBD

    Type Parameters
    Name Description
    TFsmActor

    The type of the actor. It must have a parameterless public constructor

    TState

    The type of state name

    TData

    The type of state data

    | Edit this page View Source

    ActorOf<TActor>()

    Create a new actor as child of Sys.

    Declaration
    public IActorRef ActorOf<TActor>() where TActor : ActorBase, new()
    Returns
    Type Description
    IActorRef

    TBD

    Type Parameters
    Name Description
    TActor

    The type of the actor. It must have a parameterless public constructor

    | Edit this page View Source

    ActorOf<TActor>(Expression<Func<TActor>>)

    Create a new actor as child of Sys using an expression that calls the constructor of TActor.

    ActorOf<MyActor>(()=>new MyActor("value", 4711))
    Declaration
    public IActorRef ActorOf<TActor>(Expression<Func<TActor>> factory) where TActor : ActorBase
    Parameters
    Type Name Description
    Expression<Func<TActor>> factory

    An expression that calls the constructor of TActor

    Returns
    Type Description
    IActorRef

    TBD

    Type Parameters
    Name Description
    TActor

    The type of the actor.

    | Edit this page View Source

    ActorOf<TActor>(Expression<Func<TActor>>, string)

    Create a new actor as child of Sys using an expression that calls the constructor of TActor.

    ActorOf<MyActor>(()=>new MyActor("value", 4711), "test-actor")
    Declaration
    public IActorRef ActorOf<TActor>(Expression<Func<TActor>> factory, string name) where TActor : ActorBase
    Parameters
    Type Name Description
    Expression<Func<TActor>> factory

    An expression that calls the constructor of TActor

    string name

    The name of the actor.

    Returns
    Type Description
    IActorRef

    TBD

    Type Parameters
    Name Description
    TActor

    The type of the actor.

    | Edit this page View Source

    ActorOf<TActor>(string)

    Create a new actor as child of Sys.

    Declaration
    public IActorRef ActorOf<TActor>(string name) where TActor : ActorBase, new()
    Parameters
    Type Name Description
    string name

    The name of the actor.

    Returns
    Type Description
    IActorRef

    TBD

    Type Parameters
    Name Description
    TActor

    The type of the actor. It must have a parameterless public constructor

    | Edit this page View Source

    ActorSelection(ActorPath)

    Creates an ActorSelection(ActorPath)

    Declaration
    public ActorSelection ActorSelection(ActorPath actorPath)
    Parameters
    Type Name Description
    ActorPath actorPath

    The path of the actor(s) we want to select.

    Returns
    Type Description
    ActorSelection

    An ActorSelection

    | Edit this page View Source

    ActorSelection(IActorRef, string)

    Creates an ActorSelection(string)

    Declaration
    public ActorSelection ActorSelection(IActorRef anchorRef, string actorPath)
    Parameters
    Type Name Description
    IActorRef anchorRef

    The base actor that anchors the actorPath.

    string actorPath

    The path of the actor(s) we want to select.

    Returns
    Type Description
    ActorSelection

    An ActorSelection

    | Edit this page View Source

    ActorSelection(string)

    Creates an ActorSelection(string)

    Declaration
    public ActorSelection ActorSelection(string actorPath)
    Parameters
    Type Name Description
    string actorPath

    The path of the actor(s) we want to select.

    Returns
    Type Description
    ActorSelection

    An ActorSelection

    | Edit this page View Source

    AwaitAssert(Action, TimeSpan?, TimeSpan?, CancellationToken)

    Await until the given assertion does not throw an exception or the timeout expires, whichever comes first. If the timeout expires the last exception is thrown.

    The action is called, and if it throws an exception the thread sleeps the specified interval before retrying.

    If no timeout is given, take it from the innermost enclosing `within` block.

    Note that the timeout is scaled using Dilated(TimeSpan), which uses the configuration entry "akka.test.timefactor".

    Declaration
    public void AwaitAssert(Action assertion, TimeSpan? duration = null, TimeSpan? interval = null, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    Action assertion

    The action.

    TimeSpan? duration

    The timeout.

    TimeSpan? interval

    The interval to wait between executing the assertion.

    CancellationToken cancellationToken
    | Edit this page View Source

    AwaitAssertAsync(Action, TimeSpan?, TimeSpan?, CancellationToken)

    Await until the given assertion does not throw an exception or the timeout expires, whichever comes first. If the timeout expires the last exception is thrown.

    The action is called, and if it throws an exception the thread sleeps the specified interval before retrying.

    If no timeout is given, take it from the innermost enclosing `within` block.

    Note that the timeout is scaled using Dilated(TimeSpan), which uses the configuration entry "akka.test.timefactor".

    Declaration
    public Task AwaitAssertAsync(Action assertion, TimeSpan? duration = null, TimeSpan? interval = null, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    Action assertion

    The action.

    TimeSpan? duration

    The timeout.

    TimeSpan? interval

    The interval to wait between executing the assertion.

    CancellationToken cancellationToken
    Returns
    Type Description
    Task
    | Edit this page View Source

    AwaitAssertAsync(Func<Task>, TimeSpan?, TimeSpan?, CancellationToken)

    Await until the given assertion does not throw an exception or the timeout expires, whichever comes first. If the timeout expires the last exception is thrown.

    The action is called, and if it throws an exception the thread sleeps the specified interval before retrying.

    If no timeout is given, take it from the innermost enclosing `within` block.

    Note that the timeout is scaled using Dilated(TimeSpan), which uses the configuration entry "akka.test.timefactor".

    Declaration
    public Task AwaitAssertAsync(Func<Task> assertion, TimeSpan? duration = null, TimeSpan? interval = null, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    Func<Task> assertion

    The action.

    TimeSpan? duration

    The timeout.

    TimeSpan? interval

    The interval to wait between executing the assertion.

    CancellationToken cancellationToken
    Returns
    Type Description
    Task
    | Edit this page View Source

    AwaitCondition(Func<bool>, TimeSpan?, TimeSpan?, string, CancellationToken)

    Await until the given condition evaluates to true or the timeout expires, whichever comes first.

    If no timeout is given, take it from the innermost enclosing `within` block.

    Note that the timeout is dilated, i.e. scaled by the factor specified in config value "akka.test.timefactor".

    The parameter interval specifies the time between calls to conditionIsFulfilled Between calls the thread sleeps. If interval is undefined the thread only sleeps one time, using the max as duration, and then rechecks the condition and ultimately succeeds or fails.

    To make sure that tests run as fast as possible, make sure you do not leave this value as undefined, instead set it to a relatively small value.

    Declaration
    public void AwaitCondition(Func<bool> conditionIsFulfilled, TimeSpan? max, TimeSpan? interval, string message = null, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    Func<bool> conditionIsFulfilled

    The condition that must be fulfilled within the duration.

    TimeSpan? max

    The maximum duration. If undefined, uses the remaining time (if inside a within block) or the value specified in config value "akka.test.single-expect-default". The value is dilated, i.e. scaled by the factor specified in config value "akka.test.timefactor".

    TimeSpan? interval

    The time between calls to conditionIsFulfilled to check if the condition is fulfilled. Between calls the thread sleeps. If undefined, negative or InfiniteTimeSpanthe thread only sleeps one time, using the max, and then rechecks the condition and ultimately succeeds or fails.

    To make sure that tests run as fast as possible, make sure you do not set this value as undefined, instead set it to a relatively small value.

    string message

    The message used if the timeout expires.

    CancellationToken cancellationToken
    | Edit this page View Source

    AwaitCondition(Func<bool>, TimeSpan?, string, CancellationToken)

    Await until the given condition evaluates to true or the timeout expires, whichever comes first.

    If no timeout is given, take it from the innermost enclosing `within` block (if inside a `within` block) or the value specified in config value "akka.test.single-expect-default". The value is dilated, i.e. scaled by the factor specified in config value "akka.test.timefactor"..

    A call to conditionIsFulfilled is done immediately, then the threads sleep for about a tenth of the timeout value, before it checks the condition again. This is repeated until timeout or the condition evaluates to true. To specify another interval, use the overload AwaitCondition(Func<bool>, TimeSpan?, TimeSpan?, string, CancellationToken)

    Declaration
    public void AwaitCondition(Func<bool> conditionIsFulfilled, TimeSpan? max, string message, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    Func<bool> conditionIsFulfilled

    The condition that must be fulfilled within the duration.

    TimeSpan? max

    The maximum duration. If undefined, uses the remaining time (if inside a within block) or the value specified in config value "akka.test.single-expect-default". The value is dilated, i.e. scaled by the factor specified in config value "akka.test.timefactor".

    string message

    The message used if the timeout expires.

    CancellationToken cancellationToken
    | Edit this page View Source

    AwaitCondition(Func<bool>, TimeSpan?, CancellationToken)

    Await until the given condition evaluates to true or the timeout expires, whichever comes first.

    If no timeout is given, take it from the innermost enclosing `within` block (if inside a `within` block) or the value specified in config value "akka.test.single-expect-default". The value is dilated, i.e. scaled by the factor specified in config value "akka.test.timefactor"..

    A call to conditionIsFulfilled is done immediately, then the threads sleep for about a tenth of the timeout value, before it checks the condition again. This is repeated until timeout or the condition evaluates to true. To specify another interval, use the overload AwaitCondition(Func<bool>, TimeSpan?, TimeSpan?, string, CancellationToken)

    Declaration
    public void AwaitCondition(Func<bool> conditionIsFulfilled, TimeSpan? max, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    Func<bool> conditionIsFulfilled

    The condition that must be fulfilled within the duration.

    TimeSpan? max

    The maximum duration. If undefined, uses the remaining time (if inside a within block) or the value specified in config value "akka.test.single-expect-default". The value is dilated, i.e. scaled by the factor specified in config value "akka.test.timefactor".

    CancellationToken cancellationToken
    | Edit this page View Source

    AwaitCondition(Func<bool>, CancellationToken)

    Await until the given condition evaluates to true or until a timeout

    The timeout is taken from the innermost enclosing `within` block (if inside a `within` block) or the value specified in config value "akka.test.single-expect-default". The value is dilated, i.e. scaled by the factor specified in config value "akka.test.timefactor"..

    A call to conditionIsFulfilled is done immediately, then the threads sleep for about a tenth of the timeout value, before it checks the condition again. This is repeated until timeout or the condition evaluates to true. To specify another interval, use the overload AwaitCondition(Func<bool>, TimeSpan?, TimeSpan?, string, CancellationToken)

    Declaration
    public void AwaitCondition(Func<bool> conditionIsFulfilled, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    Func<bool> conditionIsFulfilled

    The condition that must be fulfilled within the duration.

    CancellationToken cancellationToken
    | Edit this page View Source

    AwaitConditionAsync(Func<bool>, TimeSpan?, TimeSpan?, string, CancellationToken)

    Declaration
    public Task AwaitConditionAsync(Func<bool> conditionIsFulfilled, TimeSpan? max, TimeSpan? interval, string message = null, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    Func<bool> conditionIsFulfilled
    TimeSpan? max
    TimeSpan? interval
    string message
    CancellationToken cancellationToken
    Returns
    Type Description
    Task
    | Edit this page View Source

    AwaitConditionAsync(Func<bool>, TimeSpan?, string, CancellationToken)

    Declaration
    public Task AwaitConditionAsync(Func<bool> conditionIsFulfilled, TimeSpan? max, string message, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    Func<bool> conditionIsFulfilled
    TimeSpan? max
    string message
    CancellationToken cancellationToken
    Returns
    Type Description
    Task
    | Edit this page View Source

    AwaitConditionAsync(Func<bool>, CancellationToken)

    Declaration
    public Task AwaitConditionAsync(Func<bool> conditionIsFulfilled, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    Func<bool> conditionIsFulfilled
    CancellationToken cancellationToken
    Returns
    Type Description
    Task
    | Edit this page View Source

    AwaitConditionAsync(Func<Task<bool>>, TimeSpan?, TimeSpan?, string, CancellationToken)

    Declaration
    public Task AwaitConditionAsync(Func<Task<bool>> conditionIsFulfilled, TimeSpan? max, TimeSpan? interval, string message = null, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    Func<Task<bool>> conditionIsFulfilled
    TimeSpan? max
    TimeSpan? interval
    string message
    CancellationToken cancellationToken
    Returns
    Type Description
    Task
    | Edit this page View Source

    AwaitConditionAsync(Func<Task<bool>>, TimeSpan?, string, CancellationToken)

    Declaration
    public Task AwaitConditionAsync(Func<Task<bool>> conditionIsFulfilled, TimeSpan? max, string message, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    Func<Task<bool>> conditionIsFulfilled
    TimeSpan? max
    string message
    CancellationToken cancellationToken
    Returns
    Type Description
    Task
    | Edit this page View Source

    AwaitConditionAsync(Func<Task<bool>>, TimeSpan?, CancellationToken)

    Declaration
    public Task AwaitConditionAsync(Func<Task<bool>> conditionIsFulfilled, TimeSpan? max, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    Func<Task<bool>> conditionIsFulfilled
    TimeSpan? max
    CancellationToken cancellationToken
    Returns
    Type Description
    Task
    | Edit this page View Source

    AwaitConditionAsync(Func<Task<bool>>, CancellationToken)

    Declaration
    public Task AwaitConditionAsync(Func<Task<bool>> conditionIsFulfilled, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    Func<Task<bool>> conditionIsFulfilled
    CancellationToken cancellationToken
    Returns
    Type Description
    Task
    | Edit this page View Source

    AwaitConditionNoThrow(Func<bool>, TimeSpan, TimeSpan?, CancellationToken)

    Await until the given condition evaluates to true or the timeout expires, whichever comes first. Returns true if the condition was fulfilled.

    The parameter interval specifies the time between calls to conditionIsFulfilled Between calls the thread sleeps. If interval is not specified or null 100 ms is used.

    Declaration
    public bool AwaitConditionNoThrow(Func<bool> conditionIsFulfilled, TimeSpan max, TimeSpan? interval = null, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    Func<bool> conditionIsFulfilled

    The condition that must be fulfilled within the duration.

    TimeSpan max

    The maximum duration.

    TimeSpan? interval

    Optional. The time between calls to conditionIsFulfilled to check if the condition is fulfilled. Between calls the thread sleeps. If undefined, 100 ms is used

    CancellationToken cancellationToken
    Returns
    Type Description
    bool

    TBD

    | Edit this page View Source

    AwaitConditionNoThrowAsync(Func<bool>, TimeSpan, TimeSpan?, CancellationToken)

    Declaration
    public Task<bool> AwaitConditionNoThrowAsync(Func<bool> conditionIsFulfilled, TimeSpan max, TimeSpan? interval = null, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    Func<bool> conditionIsFulfilled
    TimeSpan max
    TimeSpan? interval
    CancellationToken cancellationToken
    Returns
    Type Description
    Task<bool>
    | Edit this page View Source

    AwaitConditionNoThrowAsync(Func<Task<bool>>, TimeSpan, TimeSpan?, CancellationToken)

    Declaration
    public Task<bool> AwaitConditionNoThrowAsync(Func<Task<bool>> conditionIsFulfilled, TimeSpan max, TimeSpan? interval = null, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    Func<Task<bool>> conditionIsFulfilled
    TimeSpan max
    TimeSpan? interval
    CancellationToken cancellationToken
    Returns
    Type Description
    Task<bool>
    | Edit this page View Source

    ChildActorOf(Props, SupervisorStrategy, CancellationToken)

    Spawns an actor as a child of this test actor with an auto-generated name, and returns the child's ActorRef.

    Declaration
    public IActorRef ChildActorOf(Props props, SupervisorStrategy supervisorStrategy, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    Props props

    Child actor props

    SupervisorStrategy supervisorStrategy

    Supervisor strategy for the child actor

    CancellationToken cancellationToken

    CancellationToken to cancel the operation

    Returns
    Type Description
    IActorRef
    | Edit this page View Source

    ChildActorOf(Props, string, SupervisorStrategy, CancellationToken)

    Spawns an actor as a child of this test actor, and returns the child's IActorRef

    Declaration
    public IActorRef ChildActorOf(Props props, string name, SupervisorStrategy supervisorStrategy, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    Props props

    Child actor props

    string name

    Child actor name

    SupervisorStrategy supervisorStrategy

    Supervisor strategy for the child actor

    CancellationToken cancellationToken

    CancellationToken to cancel the operation

    Returns
    Type Description
    IActorRef
    | Edit this page View Source

    ChildActorOf(Props, string, CancellationToken)

    Spawns an actor as a child of this test actor with a stopping supervisor strategy, and returns the child's ActorRef.

    Declaration
    public IActorRef ChildActorOf(Props props, string name, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    Props props

    Child actor props

    string name

    Child actor name

    CancellationToken cancellationToken

    CancellationToken to cancel the operation

    Returns
    Type Description
    IActorRef
    | Edit this page View Source

    ChildActorOf(Props, CancellationToken)

    Spawns an actor as a child of this test actor with an auto-generated name and stopping supervisor strategy, returning the child's ActorRef.

    Declaration
    public IActorRef ChildActorOf(Props props, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    Props props

    Child actor props

    CancellationToken cancellationToken

    CancellationToken to cancel the operation

    Returns
    Type Description
    IActorRef
    | Edit this page View Source

    ChildActorOfAsync(Props, SupervisorStrategy, CancellationToken)

    Spawns an actor as a child of this test actor with an auto-generated name, and returns the child's ActorRef.

    Declaration
    public Task<IActorRef> ChildActorOfAsync(Props props, SupervisorStrategy supervisorStrategy, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    Props props

    Child actor props

    SupervisorStrategy supervisorStrategy

    Supervisor strategy for the child actor

    CancellationToken cancellationToken

    CancellationToken to cancel the operation

    Returns
    Type Description
    Task<IActorRef>
    | Edit this page View Source

    ChildActorOfAsync(Props, string, SupervisorStrategy, CancellationToken)

    Spawns an actor as a child of this test actor, and returns the child's IActorRef

    Declaration
    public Task<IActorRef> ChildActorOfAsync(Props props, string name, SupervisorStrategy supervisorStrategy, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    Props props

    Child actor props

    string name

    Child actor name

    SupervisorStrategy supervisorStrategy

    Supervisor strategy for the child actor

    CancellationToken cancellationToken

    CancellationToken to cancel the operation

    Returns
    Type Description
    Task<IActorRef>
    | Edit this page View Source

    ChildActorOfAsync(Props, string, CancellationToken)

    Spawns an actor as a child of this test actor with a stopping supervisor strategy, and returns the child's ActorRef.

    Declaration
    public Task<IActorRef> ChildActorOfAsync(Props props, string name, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    Props props

    Child actor props

    string name

    Child actor name

    CancellationToken cancellationToken

    CancellationToken to cancel the operation

    Returns
    Type Description
    Task<IActorRef>
    | Edit this page View Source

    ChildActorOfAsync(Props, CancellationToken)

    Spawns an actor as a child of this test actor with an auto-generated name and stopping supervisor strategy, returning the child's ActorRef.

    Declaration
    public Task<IActorRef> ChildActorOfAsync(Props props, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    Props props

    Child actor props

    CancellationToken cancellationToken

    CancellationToken to cancel the operation

    Returns
    Type Description
    Task<IActorRef>
    | Edit this page View Source

    CreateEventFilter(ActorSystem)

    Creates a new event filter for the specified actor system.

    Declaration
    public EventFilterFactory CreateEventFilter(ActorSystem system)
    Parameters
    Type Name Description
    ActorSystem system

    Actor system.

    Returns
    Type Description
    EventFilterFactory

    A new instance of EventFilterFactory.

    | Edit this page View Source

    CreateTestActor(string)

    Creates a test actor with the specified name. The actor can be controlled by sending it special control messages, see TestActor.SetIgnore, TestActor.Watch, TestActor.Unwatch, TestActor.SetAutoPilot. All other messages are forwarded to the queue and can be retrieved with Receive and the ExpectMsg overloads.

    The default test actor can be retrieved from the TestActor property

    Declaration
    public IActorRef CreateTestActor(string name)
    Parameters
    Type Name Description
    string name

    The name of the new actor.

    Returns
    Type Description
    IActorRef

    TBD

    | Edit this page View Source

    CreateTestBarrier(int)

    Wraps a Barrier for use in testing. It always uses a timeout when waiting. Timeouts will always throw an exception. The default timeout is 5 seconds.

    Declaration
    public TestBarrier CreateTestBarrier(int count)
    Parameters
    Type Name Description
    int count

    TBD

    Returns
    Type Description
    TestBarrier

    TBD

    | Edit this page View Source

    CreateTestLatch(int)

    Creates a Countdown latch wrapper for use in testing.

    It uses a timeout when waiting and timeouts are specified as durations. There's a default timeout of 5 seconds and the default count is 1. Timeouts will always throw an exception.

    Declaration
    public virtual TestLatch CreateTestLatch(int count = 1)
    Parameters
    Type Name Description
    int count

    Optional. The count. Default: 1

    Returns
    Type Description
    TestLatch

    A new TestLatch

    | Edit this page View Source

    CreateTestProbe(ActorSystem, string)

    Creates a new TestProbe.

    Declaration
    public virtual TestProbe CreateTestProbe(ActorSystem system, string name = null)
    Parameters
    Type Name Description
    ActorSystem system

    For multi-actor system tests, you can specify which system the node is for.

    string name

    Optional: The name of the probe.

    Returns
    Type Description
    TestProbe

    TBD

    | Edit this page View Source

    CreateTestProbe(string)

    Creates a new TestProbe.

    Declaration
    public virtual TestProbe CreateTestProbe(string name = null)
    Parameters
    Type Name Description
    string name

    Optional: The name of the probe.

    Returns
    Type Description
    TestProbe

    A new TestProbe instance.

    | Edit this page View Source

    Dilated(TimeSpan)

    Multiplies the duration with the TestTimeFactor, i.e. the config value "akka.test.timefactor"

    Declaration
    public TimeSpan Dilated(TimeSpan duration)
    Parameters
    Type Name Description
    TimeSpan duration

    TBD

    Returns
    Type Description
    TimeSpan

    TBD

    | Edit this page View Source

    ExpectMsgAllOfAsync<T>(IReadOnlyCollection<T>, CancellationToken)

    Declaration
    public IAsyncEnumerable<T> ExpectMsgAllOfAsync<T>(IReadOnlyCollection<T> messages, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    IReadOnlyCollection<T> messages
    CancellationToken cancellationToken
    Returns
    Type Description
    IAsyncEnumerable<T>
    Type Parameters
    Name Description
    T
    | Edit this page View Source

    ExpectMsgAllOfAsync<T>(TimeSpan, IReadOnlyCollection<T>, CancellationToken)

    Declaration
    public IAsyncEnumerable<T> ExpectMsgAllOfAsync<T>(TimeSpan max, IReadOnlyCollection<T> messages, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    TimeSpan max
    IReadOnlyCollection<T> messages
    CancellationToken cancellationToken
    Returns
    Type Description
    IAsyncEnumerable<T>
    Type Parameters
    Name Description
    T
    | Edit this page View Source

    ExpectMsgAllOfMatchingPredicates(params PredicateInfo[])

    Declaration
    public IReadOnlyCollection<object> ExpectMsgAllOfMatchingPredicates(params PredicateInfo[] predicates)
    Parameters
    Type Name Description
    PredicateInfo[] predicates
    Returns
    Type Description
    IReadOnlyCollection<object>
    | Edit this page View Source

    ExpectMsgAllOfMatchingPredicates(IReadOnlyCollection<PredicateInfo>, CancellationToken)

    Declaration
    public IReadOnlyCollection<object> ExpectMsgAllOfMatchingPredicates(IReadOnlyCollection<PredicateInfo> predicates, CancellationToken cancellationToken)
    Parameters
    Type Name Description
    IReadOnlyCollection<PredicateInfo> predicates
    CancellationToken cancellationToken
    Returns
    Type Description
    IReadOnlyCollection<object>
    | Edit this page View Source

    ExpectMsgAllOfMatchingPredicates(TimeSpan, params PredicateInfo[])

    Declaration
    public IReadOnlyCollection<object> ExpectMsgAllOfMatchingPredicates(TimeSpan max, params PredicateInfo[] predicates)
    Parameters
    Type Name Description
    TimeSpan max
    PredicateInfo[] predicates
    Returns
    Type Description
    IReadOnlyCollection<object>
    | Edit this page View Source

    ExpectMsgAllOfMatchingPredicates(TimeSpan, IReadOnlyCollection<PredicateInfo>, CancellationToken)

    Declaration
    public IReadOnlyCollection<object> ExpectMsgAllOfMatchingPredicates(TimeSpan max, IReadOnlyCollection<PredicateInfo> predicates, CancellationToken cancellationToken)
    Parameters
    Type Name Description
    TimeSpan max
    IReadOnlyCollection<PredicateInfo> predicates
    CancellationToken cancellationToken
    Returns
    Type Description
    IReadOnlyCollection<object>
    | Edit this page View Source

    ExpectMsgAllOfMatchingPredicatesAsync(IReadOnlyCollection<PredicateInfo>, CancellationToken)

    Declaration
    public IAsyncEnumerable<object> ExpectMsgAllOfMatchingPredicatesAsync(IReadOnlyCollection<PredicateInfo> predicates, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    IReadOnlyCollection<PredicateInfo> predicates
    CancellationToken cancellationToken
    Returns
    Type Description
    IAsyncEnumerable<object>
    | Edit this page View Source

    ExpectMsgAllOfMatchingPredicatesAsync(TimeSpan, IReadOnlyCollection<PredicateInfo>, CancellationToken)

    Declaration
    public IAsyncEnumerable<object> ExpectMsgAllOfMatchingPredicatesAsync(TimeSpan max, IReadOnlyCollection<PredicateInfo> predicates, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    TimeSpan max
    IReadOnlyCollection<PredicateInfo> predicates
    CancellationToken cancellationToken
    Returns
    Type Description
    IAsyncEnumerable<object>
    | Edit this page View Source

    ExpectMsgAllOf<T>(IReadOnlyCollection<T>, CancellationToken)

    Receive a number of messages from the test actor matching the given number of objects and assert that for each given object one is received which equals it and vice versa. This construct is useful when the order in which the objects are received is not fixed. Wait time is bounded by RemainingOrDefault as duration, with an assertion exception being thrown in case of timeout.

    dispatcher.Tell(SomeWork1())
    dispatcher.Tell(SomeWork2())
    ExpectMsgAllOf(TimeSpan.FromSeconds(1), Result1(), Result2())
    Declaration
    public IReadOnlyCollection<T> ExpectMsgAllOf<T>(IReadOnlyCollection<T> messages, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    IReadOnlyCollection<T> messages

    The messages.

    CancellationToken cancellationToken
    Returns
    Type Description
    IReadOnlyCollection<T>

    The received messages in received order

    Type Parameters
    Name Description
    T

    The type of the messages

    | Edit this page View Source

    ExpectMsgAllOf<T>(TimeSpan, IReadOnlyCollection<T>, CancellationToken)

    Receive a number of messages from the test actor matching the given number of objects and assert that for each given object one is received which equals it and vice versa. This construct is useful when the order in which the objects are received is not fixed. Wait time is bounded by the given duration, with an assertion exception being thrown in case of timeout.

    dispatcher.Tell(SomeWork1())
    dispatcher.Tell(SomeWork2())
    ExpectMsgAllOf(TimeSpan.FromSeconds(1), Result1(), Result2())

    The deadline is scaled by "akka.test.timefactor" using Dilated(TimeSpan).

    Declaration
    public IReadOnlyCollection<T> ExpectMsgAllOf<T>(TimeSpan max, IReadOnlyCollection<T> messages, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    TimeSpan max

    The deadline. The deadline is scaled by "akka.test.timefactor" using Dilated(TimeSpan).

    IReadOnlyCollection<T> messages

    The messages.

    CancellationToken cancellationToken
    Returns
    Type Description
    IReadOnlyCollection<T>

    The received messages in received order

    Type Parameters
    Name Description
    T

    The type of the messages

    | Edit this page View Source

    ExpectMsgAllOf<T>(TimeSpan, params T[])

    Declaration
    public IReadOnlyCollection<T> ExpectMsgAllOf<T>(TimeSpan max, params T[] messages)
    Parameters
    Type Name Description
    TimeSpan max
    T[] messages
    Returns
    Type Description
    IReadOnlyCollection<T>
    Type Parameters
    Name Description
    T
    | Edit this page View Source

    ExpectMsgAllOf<T>(params T[])

    Declaration
    public IReadOnlyCollection<T> ExpectMsgAllOf<T>(params T[] messages)
    Parameters
    Type Name Description
    T[] messages
    Returns
    Type Description
    IReadOnlyCollection<T>
    Type Parameters
    Name Description
    T
    | Edit this page View Source

    ExpectMsgAnyOfAsync<T>(IEnumerable<T>, CancellationToken)

    Declaration
    public ValueTask<T> ExpectMsgAnyOfAsync<T>(IEnumerable<T> messages, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    IEnumerable<T> messages
    CancellationToken cancellationToken
    Returns
    Type Description
    ValueTask<T>
    Type Parameters
    Name Description
    T
    | Edit this page View Source

    ExpectMsgAnyOf<T>(IEnumerable<T>, CancellationToken)

    Receive a message from the test actor and assert that it equals one of the given messages. Wait time is bounded by RemainingOrDefault as duration, with an assertion exception being thrown in case of timeout.

    Declaration
    public T ExpectMsgAnyOf<T>(IEnumerable<T> messages, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    IEnumerable<T> messages

    The messages.

    CancellationToken cancellationToken
    Returns
    Type Description
    T

    The received messages in received order

    Type Parameters
    Name Description
    T

    The type of the messages

    | Edit this page View Source

    ExpectMsgAsync<T>(Action<T, IActorRef>, TimeSpan?, string, CancellationToken)

    Receive one message of the specified type from the test actor calls the action that performs extra assertions. Use this variant to implement more complicated or conditional processing.

    Wait time is bounded by the given duration, if specified; otherwise wait time is bounded by remaining time for execution of the innermost enclosing 'within' block, if inside a 'within' block; otherwise by the config value "akka.test.single-expect-default".

    Declaration
    public ValueTask<T> ExpectMsgAsync<T>(Action<T, IActorRef> assertMessageAndSender, TimeSpan? timeout = null, string hint = null, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    Action<T, IActorRef> assertMessageAndSender

    TBD

    TimeSpan? timeout

    TBD

    string hint

    TBD

    CancellationToken cancellationToken
    Returns
    Type Description
    ValueTask<T>

    TBD

    Type Parameters
    Name Description
    T

    TBD

    | Edit this page View Source

    ExpectMsgAsync<T>(Action<T>, TimeSpan?, string, CancellationToken)

    Receive one message of the specified type from the test actor and calls the action that performs extra assertions. Use this variant to implement more complicated or conditional processing.

    Wait time is bounded by the given duration, if specified; otherwise wait time is bounded by remaining time for execution of the innermost enclosing 'within' block, if inside a 'within' block; otherwise by the config value "akka.test.single-expect-default".

    Declaration
    public ValueTask<T> ExpectMsgAsync<T>(Action<T> assert, TimeSpan? timeout = null, string hint = null, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    Action<T> assert

    TBD

    TimeSpan? timeout

    TBD

    string hint

    TBD

    CancellationToken cancellationToken
    Returns
    Type Description
    ValueTask<T>

    TBD

    Type Parameters
    Name Description
    T

    TBD

    | Edit this page View Source

    ExpectMsgAsync<T>(Func<T, IActorRef, bool>, TimeSpan?, string, CancellationToken)

    Receive one message of the specified type from the test actor and assert that the given predicate accepts it. Use this variant to implement more complicated or conditional processing.

    Wait time is bounded by the given duration, if specified; otherwise wait time is bounded by remaining time for execution of the innermost enclosing 'within' block, if inside a 'within' block; otherwise by the config value "akka.test.single-expect-default".

    Declaration
    public ValueTask<T> ExpectMsgAsync<T>(Func<T, IActorRef, bool> isMessageAndSender, TimeSpan? timeout = null, string hint = null, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    Func<T, IActorRef, bool> isMessageAndSender

    TBD

    TimeSpan? timeout

    TBD

    string hint

    TBD

    CancellationToken cancellationToken
    Returns
    Type Description
    ValueTask<T>

    TBD

    Type Parameters
    Name Description
    T

    TBD

    | Edit this page View Source

    ExpectMsgAsync<T>(TimeSpan?, string, CancellationToken)

    Receive one message from the test actor and assert that it is of the specified type. Wait time is bounded by the given duration, if specified; otherwise wait time is bounded by remaining time for execution of the innermost enclosing 'within' block, if inside a 'within' block; otherwise by the config value "akka.test.single-expect-default".

    Declaration
    public ValueTask<T> ExpectMsgAsync<T>(TimeSpan? duration = null, string hint = null, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    TimeSpan? duration

    TBD

    string hint

    TBD

    CancellationToken cancellationToken
    Returns
    Type Description
    ValueTask<T>

    TBD

    Type Parameters
    Name Description
    T

    TBD

    | Edit this page View Source

    ExpectMsgAsync<T>(Predicate<T>, TimeSpan?, string, CancellationToken)

    Receive one message of the specified type from the test actor and assert that the given predicate accepts it. Use this variant to implement more complicated or conditional processing.

    Wait time is bounded by the given duration, if specified; otherwise wait time is bounded by remaining time for execution of the innermost enclosing 'within' block, if inside a 'within' block; otherwise by the config value "akka.test.single-expect-default".

    Declaration
    public ValueTask<T> ExpectMsgAsync<T>(Predicate<T> isMessage, TimeSpan? timeout = null, string hint = null, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    Predicate<T> isMessage

    TBD

    TimeSpan? timeout

    TBD

    string hint

    TBD

    CancellationToken cancellationToken
    Returns
    Type Description
    ValueTask<T>

    TBD

    Type Parameters
    Name Description
    T

    TBD

    | Edit this page View Source

    ExpectMsgAsync<T>(T, Func<T, T, bool>, TimeSpan?, string, CancellationToken)

    Receive one message from the test actor and assert that it is equal to the expected value, according to the specified comparer function.

    Wait time is bounded by remaining time for execution of the innermost enclosing 'within' block, if inside a 'within' block; otherwise by the config value "akka.test.single-expect-default".

    Declaration
    public ValueTask<T> ExpectMsgAsync<T>(T expected, Func<T, T, bool> comparer, TimeSpan? timeout = null, string hint = null, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    T expected

    TBD

    Func<T, T, bool> comparer

    TBD

    TimeSpan? timeout

    TBD

    string hint

    TBD

    CancellationToken cancellationToken
    Returns
    Type Description
    ValueTask<T>

    TBD

    Type Parameters
    Name Description
    T

    TBD

    | Edit this page View Source

    ExpectMsgAsync<T>(T, TimeSpan?, string, CancellationToken)

    Receive one message of the specified type from the test actor and assert that it equals the message. Wait time is bounded by the given duration, if specified; otherwise wait time is bounded by remaining time for execution of the innermost enclosing 'within' block, if inside a 'within' block; otherwise by the config value "akka.test.single-expect-default".

    Declaration
    public ValueTask<T> ExpectMsgAsync<T>(T message, TimeSpan? timeout = null, string hint = null, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    T message

    TBD

    TimeSpan? timeout

    TBD

    string hint

    TBD

    CancellationToken cancellationToken
    Returns
    Type Description
    ValueTask<T>

    TBD

    Type Parameters
    Name Description
    T

    TBD

    | Edit this page View Source

    ExpectMsgFromAsync<T>(IActorRef, Action<T>, TimeSpan?, string, CancellationToken)

    Declaration
    public ValueTask<T> ExpectMsgFromAsync<T>(IActorRef sender, Action<T> assertMessage, TimeSpan? timeout = null, string hint = null, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    IActorRef sender
    Action<T> assertMessage
    TimeSpan? timeout
    string hint
    CancellationToken cancellationToken
    Returns
    Type Description
    ValueTask<T>
    Type Parameters
    Name Description
    T
    | Edit this page View Source

    ExpectMsgFromAsync<T>(IActorRef, TimeSpan?, string, CancellationToken)

    Declaration
    public ValueTask<T> ExpectMsgFromAsync<T>(IActorRef sender, TimeSpan? duration = null, string hint = null, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    IActorRef sender
    TimeSpan? duration
    string hint
    CancellationToken cancellationToken
    Returns
    Type Description
    ValueTask<T>
    Type Parameters
    Name Description
    T
    | Edit this page View Source

    ExpectMsgFromAsync<T>(IActorRef, Predicate<T>, TimeSpan?, string, CancellationToken)

    Declaration
    public ValueTask<T> ExpectMsgFromAsync<T>(IActorRef sender, Predicate<T> isMessage, TimeSpan? timeout = null, string hint = null, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    IActorRef sender
    Predicate<T> isMessage
    TimeSpan? timeout
    string hint
    CancellationToken cancellationToken
    Returns
    Type Description
    ValueTask<T>
    Type Parameters
    Name Description
    T
    | Edit this page View Source

    ExpectMsgFromAsync<T>(IActorRef, T, TimeSpan?, string, CancellationToken)

    Declaration
    public ValueTask<T> ExpectMsgFromAsync<T>(IActorRef sender, T message, TimeSpan? timeout = null, string hint = null, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    IActorRef sender
    T message
    TimeSpan? timeout
    string hint
    CancellationToken cancellationToken
    Returns
    Type Description
    ValueTask<T>
    Type Parameters
    Name Description
    T
    | Edit this page View Source

    ExpectMsgFromAsync<T>(Action<IActorRef>, Action<T>, TimeSpan?, string, CancellationToken)

    Declaration
    public ValueTask<T> ExpectMsgFromAsync<T>(Action<IActorRef> assertSender, Action<T> assertMessage, TimeSpan? timeout = null, string hint = null, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    Action<IActorRef> assertSender
    Action<T> assertMessage
    TimeSpan? timeout
    string hint
    CancellationToken cancellationToken
    Returns
    Type Description
    ValueTask<T>
    Type Parameters
    Name Description
    T
    | Edit this page View Source

    ExpectMsgFromAsync<T>(Predicate<IActorRef>, Predicate<T>, TimeSpan?, string, CancellationToken)

    Declaration
    public ValueTask<T> ExpectMsgFromAsync<T>(Predicate<IActorRef> isSender, Predicate<T> isMessage, TimeSpan? timeout = null, string hint = null, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    Predicate<IActorRef> isSender
    Predicate<T> isMessage
    TimeSpan? timeout
    string hint
    CancellationToken cancellationToken
    Returns
    Type Description
    ValueTask<T>
    Type Parameters
    Name Description
    T
    | Edit this page View Source

    ExpectMsgFrom<T>(IActorRef, Action<T>, TimeSpan?, string, CancellationToken)

    Receive one message of the specified type from the test actor, verifies that the sender is the specified and calls the action that performs extra assertions. Wait time is bounded by the given duration if specified. If not specified, wait time is bounded by remaining time for execution of the innermost enclosing 'within' block, if inside a 'within' block; otherwise by the config value "akka.test.single-expect-default". Use this variant to implement more complicated or conditional processing.

    Declaration
    public T ExpectMsgFrom<T>(IActorRef sender, Action<T> assertMessage, TimeSpan? timeout = null, string hint = null, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    IActorRef sender

    TBD

    Action<T> assertMessage

    TBD

    TimeSpan? timeout

    TBD

    string hint

    TBD

    CancellationToken cancellationToken
    Returns
    Type Description
    T

    TBD

    Type Parameters
    Name Description
    T

    TBD

    | Edit this page View Source

    ExpectMsgFrom<T>(IActorRef, TimeSpan?, string, CancellationToken)

    Receive one message from the test actor and assert that it is of the specified type and was sent by the specified sender Wait time is bounded by the given duration if specified. If not specified, wait time is bounded by remaining time for execution of the innermost enclosing 'within' block, if inside a 'within' block; otherwise by the config value "akka.test.single-expect-default".

    Declaration
    public T ExpectMsgFrom<T>(IActorRef sender, TimeSpan? duration = null, string hint = null, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    IActorRef sender

    TBD

    TimeSpan? duration

    TBD

    string hint

    TBD

    CancellationToken cancellationToken
    Returns
    Type Description
    T

    TBD

    Type Parameters
    Name Description
    T

    TBD

    | Edit this page View Source

    ExpectMsgFrom<T>(IActorRef, Predicate<T>, TimeSpan?, string, CancellationToken)

    Receive one message of the specified type from the test actor and assert that the given predicate accepts it and was sent by the specified sender Wait time is bounded by the given duration if specified. If not specified, wait time is bounded by remaining time for execution of the innermost enclosing 'within' block, if inside a 'within' block; otherwise by the config value "akka.test.single-expect-default". Use this variant to implement more complicated or conditional processing.

    Declaration
    public T ExpectMsgFrom<T>(IActorRef sender, Predicate<T> isMessage, TimeSpan? timeout = null, string hint = null, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    IActorRef sender

    TBD

    Predicate<T> isMessage

    TBD

    TimeSpan? timeout

    TBD

    string hint

    TBD

    CancellationToken cancellationToken
    Returns
    Type Description
    T

    TBD

    Type Parameters
    Name Description
    T

    TBD

    | Edit this page View Source

    ExpectMsgFrom<T>(IActorRef, T, TimeSpan?, string, CancellationToken)

    Receive one message of the specified type from the test actor and assert that it equals the message and was sent by the specified sender Wait time is bounded by the given duration if specified. If not specified, wait time is bounded by remaining time for execution of the innermost enclosing 'within' block, if inside a 'within' block; otherwise by the config value "akka.test.single-expect-default".

    Declaration
    public T ExpectMsgFrom<T>(IActorRef sender, T message, TimeSpan? timeout = null, string hint = null, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    IActorRef sender

    TBD

    T message

    TBD

    TimeSpan? timeout

    TBD

    string hint

    TBD

    CancellationToken cancellationToken
    Returns
    Type Description
    T

    TBD

    Type Parameters
    Name Description
    T

    TBD

    | Edit this page View Source

    ExpectMsgFrom<T>(Action<IActorRef>, Action<T>, TimeSpan?, string, CancellationToken)

    Receive one message of the specified type from the test actor and calls the action that performs extra assertions. Wait time is bounded by the given duration if specified. If not specified, wait time is bounded by remaining time for execution of the innermost enclosing 'within' block, if inside a 'within' block; otherwise by the config value "akka.test.single-expect-default". Use this variant to implement more complicated or conditional processing.

    Declaration
    public T ExpectMsgFrom<T>(Action<IActorRef> assertSender, Action<T> assertMessage, TimeSpan? timeout = null, string hint = null, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    Action<IActorRef> assertSender

    TBD

    Action<T> assertMessage

    TBD

    TimeSpan? timeout

    TBD

    string hint

    TBD

    CancellationToken cancellationToken
    Returns
    Type Description
    T

    TBD

    Type Parameters
    Name Description
    T

    TBD

    | Edit this page View Source

    ExpectMsgFrom<T>(Predicate<IActorRef>, Predicate<T>, TimeSpan?, string, CancellationToken)

    Receive one message of the specified type from the test actor and assert that the given predicate accepts it and was sent by a sender that matches the isSender predicate. Wait time is bounded by the given duration if specified. If not specified, wait time is bounded by remaining time for execution of the innermost enclosing 'within' block, if inside a 'within' block; otherwise by the config value "akka.test.single-expect-default". Use this variant to implement more complicated or conditional processing.

    Declaration
    public T ExpectMsgFrom<T>(Predicate<IActorRef> isSender, Predicate<T> isMessage, TimeSpan? timeout = null, string hint = null, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    Predicate<IActorRef> isSender

    TBD

    Predicate<T> isMessage

    TBD

    TimeSpan? timeout

    TBD

    string hint

    TBD

    CancellationToken cancellationToken
    Returns
    Type Description
    T

    TBD

    Type Parameters
    Name Description
    T

    TBD

    | Edit this page View Source

    ExpectMsg<T>(Action<T, IActorRef>, TimeSpan?, string, CancellationToken)

    Receive one message of the specified type from the test actor calls the action that performs extra assertions. Use this variant to implement more complicated or conditional processing.

    Wait time is bounded by the given duration, if specified; otherwise wait time is bounded by remaining time for execution of the innermost enclosing 'within' block, if inside a 'within' block; otherwise by the config value "akka.test.single-expect-default".

    Declaration
    public T ExpectMsg<T>(Action<T, IActorRef> assertMessageAndSender, TimeSpan? timeout = null, string hint = null, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    Action<T, IActorRef> assertMessageAndSender

    TBD

    TimeSpan? timeout

    TBD

    string hint

    TBD

    CancellationToken cancellationToken
    Returns
    Type Description
    T

    TBD

    Type Parameters
    Name Description
    T

    TBD

    | Edit this page View Source

    ExpectMsg<T>(Action<T>, TimeSpan?, string, CancellationToken)

    Receive one message of the specified type from the test actor and calls the action that performs extra assertions. Use this variant to implement more complicated or conditional processing.

    Wait time is bounded by the given duration, if specified; otherwise wait time is bounded by remaining time for execution of the innermost enclosing 'within' block, if inside a 'within' block; otherwise by the config value "akka.test.single-expect-default".

    Declaration
    public T ExpectMsg<T>(Action<T> assert, TimeSpan? timeout = null, string hint = null, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    Action<T> assert

    TBD

    TimeSpan? timeout

    TBD

    string hint

    TBD

    CancellationToken cancellationToken
    Returns
    Type Description
    T

    TBD

    Type Parameters
    Name Description
    T

    TBD

    | Edit this page View Source

    ExpectMsg<T>(Func<T, IActorRef, bool>, TimeSpan?, string, CancellationToken)

    Receive one message of the specified type from the test actor and assert that the given predicate accepts it. Use this variant to implement more complicated or conditional processing.

    Wait time is bounded by the given duration, if specified; otherwise wait time is bounded by remaining time for execution of the innermost enclosing 'within' block, if inside a 'within' block; otherwise by the config value "akka.test.single-expect-default".

    Declaration
    public T ExpectMsg<T>(Func<T, IActorRef, bool> isMessageAndSender, TimeSpan? timeout = null, string hint = null, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    Func<T, IActorRef, bool> isMessageAndSender

    TBD

    TimeSpan? timeout

    TBD

    string hint

    TBD

    CancellationToken cancellationToken
    Returns
    Type Description
    T

    TBD

    Type Parameters
    Name Description
    T

    TBD

    | Edit this page View Source

    ExpectMsg<T>(TimeSpan?, string, CancellationToken)

    Receive one message from the test actor and assert that it is of the specified type. Wait time is bounded by the given duration, if specified; otherwise wait time is bounded by remaining time for execution of the innermost enclosing 'within' block, if inside a 'within' block; otherwise by the config value "akka.test.single-expect-default".

    Declaration
    public T ExpectMsg<T>(TimeSpan? duration = null, string hint = null, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    TimeSpan? duration

    TBD

    string hint

    TBD

    CancellationToken cancellationToken
    Returns
    Type Description
    T

    TBD

    Type Parameters
    Name Description
    T

    TBD

    | Edit this page View Source

    ExpectMsg<T>(Predicate<T>, TimeSpan?, string, CancellationToken)

    Receive one message of the specified type from the test actor and assert that the given predicate accepts it. Use this variant to implement more complicated or conditional processing.

    Wait time is bounded by the given duration, if specified; otherwise wait time is bounded by remaining time for execution of the innermost enclosing 'within' block, if inside a 'within' block; otherwise by the config value "akka.test.single-expect-default".

    Declaration
    public T ExpectMsg<T>(Predicate<T> isMessage, TimeSpan? timeout = null, string hint = null, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    Predicate<T> isMessage

    TBD

    TimeSpan? timeout

    TBD

    string hint

    TBD

    CancellationToken cancellationToken
    Returns
    Type Description
    T

    TBD

    Type Parameters
    Name Description
    T

    TBD

    | Edit this page View Source

    ExpectMsg<T>(T, Func<T, T, bool>, TimeSpan?, string, CancellationToken)

    Receive one message from the test actor and assert that it is equal to the expected value, according to the specified comparer function.

    Wait time is bounded by remaining time for execution of the innermost enclosing 'within' block, if inside a 'within' block; otherwise by the config value "akka.test.single-expect-default".

    Declaration
    public T ExpectMsg<T>(T expected, Func<T, T, bool> comparer, TimeSpan? timeout = null, string hint = null, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    T expected

    TBD

    Func<T, T, bool> comparer

    TBD

    TimeSpan? timeout

    TBD

    string hint

    TBD

    CancellationToken cancellationToken
    Returns
    Type Description
    T

    TBD

    Type Parameters
    Name Description
    T

    TBD

    | Edit this page View Source

    ExpectMsg<T>(T, TimeSpan?, string, CancellationToken)

    Receive one message of the specified type from the test actor and assert that it equals the message. Wait time is bounded by the given duration, if specified; otherwise wait time is bounded by remaining time for execution of the innermost enclosing 'within' block, if inside a 'within' block; otherwise by the config value "akka.test.single-expect-default".

    Declaration
    public T ExpectMsg<T>(T message, TimeSpan? timeout = null, string hint = null, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    T message

    TBD

    TimeSpan? timeout

    TBD

    string hint

    TBD

    CancellationToken cancellationToken
    Returns
    Type Description
    T

    TBD

    Type Parameters
    Name Description
    T

    TBD

    | Edit this page View Source

    ExpectNoMsg(int, CancellationToken)

    Assert that no message is received for the specified time in milliseconds.

    Declaration
    public void ExpectNoMsg(int milliseconds, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    int milliseconds

    TBD

    CancellationToken cancellationToken
    | Edit this page View Source

    ExpectNoMsg(CancellationToken)

    Assert that no message is received.

    Wait time is bounded by remaining time for execution of the innermost enclosing 'within' block, if inside a 'within' block; otherwise by the config value "akka.test.single-expect-default".

    Declaration
    public void ExpectNoMsg(CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    CancellationToken cancellationToken
    | Edit this page View Source

    ExpectNoMsg(TimeSpan, CancellationToken)

    Assert that no message is received for the specified time.

    Declaration
    public void ExpectNoMsg(TimeSpan duration, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    TimeSpan duration

    TBD

    CancellationToken cancellationToken
    | Edit this page View Source

    ExpectNoMsgAsync(int, CancellationToken)

    Assert that no message is received for the specified time in milliseconds.

    Declaration
    public ValueTask ExpectNoMsgAsync(int milliseconds, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    int milliseconds

    TBD

    CancellationToken cancellationToken
    Returns
    Type Description
    ValueTask
    | Edit this page View Source

    ExpectNoMsgAsync(CancellationToken)

    Assert that no message is received.

    Wait time is bounded by remaining time for execution of the innermost enclosing 'within' block, if inside a 'within' block; otherwise by the config value "akka.test.single-expect-default".

    Declaration
    public ValueTask ExpectNoMsgAsync(CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    CancellationToken cancellationToken
    Returns
    Type Description
    ValueTask
    | Edit this page View Source

    ExpectNoMsgAsync(TimeSpan, CancellationToken)

    Assert that no message is received for the specified time.

    Declaration
    public ValueTask ExpectNoMsgAsync(TimeSpan duration, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    TimeSpan duration

    TBD

    CancellationToken cancellationToken
    Returns
    Type Description
    ValueTask
    | Edit this page View Source

    ExpectTerminated(IActorRef, TimeSpan?, string, CancellationToken)

    Receive one message from the test actor and assert that it is the Terminated message of the given ActorRef.

    Wait time is bounded by the given duration, if specified; otherwise wait time is bounded by remaining time for execution of the innermost enclosing 'within' block, if inside a 'within' block; otherwise by the config value "akka.test.single-expect-default".

    Declaration
    public Terminated ExpectTerminated(IActorRef target, TimeSpan? timeout = null, string hint = null, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    IActorRef target

    TBD

    TimeSpan? timeout

    TBD

    string hint

    TBD

    CancellationToken cancellationToken
    Returns
    Type Description
    Terminated

    TBD

    | Edit this page View Source

    ExpectTerminatedAsync(IActorRef, TimeSpan?, string, CancellationToken)

    Receive one message from the test actor and assert that it is the Terminated message of the given ActorRef.

    Wait time is bounded by the given duration, if specified; otherwise wait time is bounded by remaining time for execution of the innermost enclosing 'within' block, if inside a 'within' block; otherwise by the config value "akka.test.single-expect-default".

    Declaration
    public ValueTask<Terminated> ExpectTerminatedAsync(IActorRef target, TimeSpan? timeout = null, string hint = null, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    IActorRef target

    TBD

    TimeSpan? timeout

    TBD

    string hint

    TBD

    CancellationToken cancellationToken
    Returns
    Type Description
    ValueTask<Terminated>

    TBD

    | Edit this page View Source

    FishForMessage(Predicate<object>, TimeSpan?, string, CancellationToken)

    Receives messages until isMessage returns true. Use it to ignore certain messages while waiting for a specific message.

    Declaration
    public object FishForMessage(Predicate<object> isMessage, TimeSpan? max = null, string hint = "", CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    Predicate<object> isMessage

    The is message.

    TimeSpan? max

    The maximum.

    string hint

    The hint.

    CancellationToken cancellationToken
    Returns
    Type Description
    object

    Returns the message that isMessage matched

    | Edit this page View Source

    FishForMessageAsync(Predicate<object>, TimeSpan?, string, CancellationToken)

    Receives messages until isMessage returns true. Use it to ignore certain messages while waiting for a specific message.

    Declaration
    public ValueTask<object> FishForMessageAsync(Predicate<object> isMessage, TimeSpan? max = null, string hint = "", CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    Predicate<object> isMessage

    The is message.

    TimeSpan? max

    The maximum.

    string hint

    The hint.

    CancellationToken cancellationToken
    Returns
    Type Description
    ValueTask<object>

    Returns the message that isMessage matched

    | Edit this page View Source

    FishForMessageAsync<T>(Predicate<T>, ArrayList, TimeSpan?, string, CancellationToken)

    Receives messages until isMessage returns true. Use it to ignore certain messages while waiting for a specific message.

    Declaration
    public ValueTask<T> FishForMessageAsync<T>(Predicate<T> isMessage, ArrayList allMessages, TimeSpan? max = null, string hint = "", CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    Predicate<T> isMessage

    The is message.

    ArrayList allMessages

    If null then will be ignored. If not null then will be initially cleared, then filled with all the messages until isMessage returns true

    TimeSpan? max

    The maximum.

    string hint

    The hint.

    CancellationToken cancellationToken
    Returns
    Type Description
    ValueTask<T>

    Returns the message that isMessage matched

    Type Parameters
    Name Description
    T

    The type of the expected message. Messages of other types are ignored.

    | Edit this page View Source

    FishForMessageAsync<T>(Predicate<T>, TimeSpan?, string, CancellationToken)

    Receives messages until isMessage returns true. Use it to ignore certain messages while waiting for a specific message.

    Declaration
    public ValueTask<T> FishForMessageAsync<T>(Predicate<T> isMessage, TimeSpan? max = null, string hint = "", CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    Predicate<T> isMessage

    The is message.

    TimeSpan? max

    The maximum.

    string hint

    The hint.

    CancellationToken cancellationToken
    Returns
    Type Description
    ValueTask<T>

    Returns the message that isMessage matched

    Type Parameters
    Name Description
    T

    The type of the expected message. Messages of other types are ignored.

    | Edit this page View Source

    FishForMessage<T>(Predicate<T>, ArrayList, TimeSpan?, string, CancellationToken)

    Receives messages until isMessage returns true. Use it to ignore certain messages while waiting for a specific message.

    Declaration
    public T FishForMessage<T>(Predicate<T> isMessage, ArrayList allMessages, TimeSpan? max = null, string hint = "", CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    Predicate<T> isMessage

    The is message.

    ArrayList allMessages

    If null then will be ignored. If not null then will be initially cleared, then filled with all the messages until isMessage returns true

    TimeSpan? max

    The maximum.

    string hint

    The hint.

    CancellationToken cancellationToken
    Returns
    Type Description
    T

    Returns the message that isMessage matched

    Type Parameters
    Name Description
    T

    The type of the expected message. Messages of other types are ignored.

    | Edit this page View Source

    FishForMessage<T>(Predicate<T>, TimeSpan?, string, CancellationToken)

    Receives messages until isMessage returns true. Use it to ignore certain messages while waiting for a specific message.

    Declaration
    public T FishForMessage<T>(Predicate<T> isMessage, TimeSpan? max = null, string hint = "", CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    Predicate<T> isMessage

    The is message.

    TimeSpan? max

    The maximum.

    string hint

    The hint.

    CancellationToken cancellationToken
    Returns
    Type Description
    T

    Returns the message that isMessage matched

    Type Parameters
    Name Description
    T

    The type of the expected message. Messages of other types are ignored.

    | Edit this page View Source

    FishUntilMessageAsync<T>(TimeSpan?, CancellationToken)

    Receives messages until max.

    Ignores all messages except for a message of type T. Asserts that all messages are not of the of type T.

    Declaration
    public Task FishUntilMessageAsync<T>(TimeSpan? max = null, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    TimeSpan? max

    Optional. The maximum wait duration. Defaults to RemainingOrDefault when unset.

    CancellationToken cancellationToken
    Returns
    Type Description
    Task
    Type Parameters
    Name Description
    T

    The type that the message is not supposed to be.

    | Edit this page View Source

    GetTimeoutOrDefault(TimeSpan?)

    If timeout is defined it is returned; otherwise the config value "akka.test.single-expect-default" is returned.

    Declaration
    public TimeSpan GetTimeoutOrDefault(TimeSpan? timeout)
    Parameters
    Type Name Description
    TimeSpan? timeout

    TBD

    Returns
    Type Description
    TimeSpan

    TBD

    | Edit this page View Source

    IgnoreMessages(Func<object, bool>)

    Ignore all messages in the test actor for which the given function returns true.

    Declaration
    public void IgnoreMessages(Func<object, bool> shouldIgnoreMessage)
    Parameters
    Type Name Description
    Func<object, bool> shouldIgnoreMessage

    Given a message, if the function returns true the message will be ignored by TestActor.

    | Edit this page View Source

    IgnoreMessages<TMsg>()

    Ignore all messages in the test actor of the given TMsg type.

    Declaration
    public void IgnoreMessages<TMsg>()
    Type Parameters
    Name Description
    TMsg

    The type of the message to ignore.

    | Edit this page View Source

    IgnoreMessages<TMsg>(Func<TMsg, bool>)

    Ignore all messages in the test actor of the given TMsg type for which the given function returns true.

    Declaration
    public void IgnoreMessages<TMsg>(Func<TMsg, bool> shouldIgnoreMessage)
    Parameters
    Type Name Description
    Func<TMsg, bool> shouldIgnoreMessage

    Given a message, if the function returns true the message will be ignored by TestActor.

    Type Parameters
    Name Description
    TMsg

    The type of the message to ignore.

    | Edit this page View Source

    IgnoreNoMessages()

    Stop ignoring messages in the test actor.

    Declaration
    public void IgnoreNoMessages()
    | Edit this page View Source

    InitializeTest(ActorSystem, ActorSystemSetup, string, string)

    Initializes the TestKitBase.TestState for a new spec.

    Declaration
    protected virtual void InitializeTest(ActorSystem system, ActorSystemSetup config, string actorSystemName, string testActorName)
    Parameters
    Type Name Description
    ActorSystem system

    The actor system this test will use. Can be null.

    ActorSystemSetup config

    The configuration that system will use if it's null.

    string actorSystemName

    The name that system will use if it's null.

    string testActorName

    The name of the test actor. Can be null.

    | Edit this page View Source

    InitializeTest(ActorSystem, Config, string, string)

    Initializes the TestKitBase.TestState for a new spec.

    Declaration
    protected void InitializeTest(ActorSystem system, Config config, string actorSystemName, string testActorName)
    Parameters
    Type Name Description
    ActorSystem system

    The actor system this test will use. Can be null.

    Config config

    The configuration that system will use if it's null.

    string actorSystemName

    The name that system will use if it's null.

    string testActorName

    The name of the test actor. Can be null.

    | Edit this page View Source

    InternalAwaitCondition(Func<bool>, TimeSpan, TimeSpan?, Action<string, object[]>, ILoggingAdapter, CancellationToken)

    Await until the given condition evaluates to true or the timeout expires, whichever comes first.

    If no timeout is given, take it from the innermost enclosing `within` block.

    Note that the timeout is dilated, i.e. scaled by the factor specified in config value "akka.test.timefactor".

    The parameter interval specifies the time between calls to conditionIsFulfilled Between calls the thread sleeps. If interval is undefined the thread only sleeps one time, using the max as duration, and then rechecks the condition and ultimately succeeds or fails.

    To make sure that tests run as fast as possible, make sure you do not leave this value as undefined, instead set it to a relatively small value.

    Declaration
    protected static bool InternalAwaitCondition(Func<bool> conditionIsFulfilled, TimeSpan max, TimeSpan? interval, Action<string, object[]> fail, ILoggingAdapter logger, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    Func<bool> conditionIsFulfilled

    The condition that must be fulfilled within the duration.

    TimeSpan max

    The maximum duration. The value is dilated, i.e. scaled by the factor specified in config value "akka.test.timefactor".

    TimeSpan? interval

    The time between calls to conditionIsFulfilled to check if the condition is fulfilled. Between calls the thread sleeps. If undefined the thread only sleeps one time, using the max, and then rechecks the condition and ultimately succeeds or fails.

    To make sure that tests run as fast as possible, make sure you do not set this value as undefined, instead set it to a relatively small value.

    Action<string, object[]> fail

    Action that is called when the timeout expired. The parameters conforms to Format(string, params object[])

    ILoggingAdapter logger

    If a ILoggingAdapter is specified, debug messages will be logged using it. If null nothing will be logged

    CancellationToken cancellationToken
    Returns
    Type Description
    bool

    TBD

    | Edit this page View Source

    InternalAwaitCondition(Func<bool>, TimeSpan, TimeSpan?, Action<string, object[]>, CancellationToken)

    Await until the given condition evaluates to true or the timeout expires, whichever comes first.

    If no timeout is given, take it from the innermost enclosing `within` block.

    Note that the timeout is dilated, i.e. scaled by the factor specified in config value "akka.test.timefactor".

    The parameter interval specifies the time between calls to conditionIsFulfilled Between calls the thread sleeps. If interval is undefined the thread only sleeps one time, using the max as duration, and then rechecks the condition and ultimately succeeds or fails.

    To make sure that tests run as fast as possible, make sure you do not leave this value as undefined, instead set it to a relatively small value.

    Declaration
    protected static bool InternalAwaitCondition(Func<bool> conditionIsFulfilled, TimeSpan max, TimeSpan? interval, Action<string, object[]> fail, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    Func<bool> conditionIsFulfilled

    The condition that must be fulfilled within the duration.

    TimeSpan max

    The maximum duration. The value is dilated, i.e. scaled by the factor specified in config value "akka.test.timefactor".

    TimeSpan? interval

    The time between calls to conditionIsFulfilled to check if the condition is fulfilled. Between calls the thread sleeps. If undefined the thread only sleeps one time, using the max, and then rechecks the condition and ultimately succeeds or fails.

    To make sure that tests run as fast as possible, make sure you do not set this value as undefined, instead set it to a relatively small value.

    Action<string, object[]> fail

    Action that is called when the timeout expired. The parameters conforms to Format(string, params object[])

    CancellationToken cancellationToken
    Returns
    Type Description
    bool

    TBD

    | Edit this page View Source

    InternalAwaitConditionAsync(Func<Task<bool>>, TimeSpan, TimeSpan?, Action<string, object[]>, ILoggingAdapter, CancellationToken)

    Declaration
    protected static Task<bool> InternalAwaitConditionAsync(Func<Task<bool>> conditionIsFulfilled, TimeSpan max, TimeSpan? interval, Action<string, object[]> fail, ILoggingAdapter logger, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    Func<Task<bool>> conditionIsFulfilled
    TimeSpan max
    TimeSpan? interval
    Action<string, object[]> fail
    ILoggingAdapter logger
    CancellationToken cancellationToken
    Returns
    Type Description
    Task<bool>
    | Edit this page View Source

    InternalAwaitConditionAsync(Func<Task<bool>>, TimeSpan, TimeSpan?, Action<string, object[]>, CancellationToken)

    Declaration
    protected static Task<bool> InternalAwaitConditionAsync(Func<Task<bool>> conditionIsFulfilled, TimeSpan max, TimeSpan? interval, Action<string, object[]> fail, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    Func<Task<bool>> conditionIsFulfilled
    TimeSpan max
    TimeSpan? interval
    Action<string, object[]> fail
    CancellationToken cancellationToken
    Returns
    Type Description
    Task<bool>
    | Edit this page View Source

    PeekOne(TimeSpan?, CancellationToken)

    Peek one message from the head of the internal queue of the TestActor. This method blocks the specified duration or until a message is received. If no message was received, null is returned. This method does NOT automatically scale its Duration parameter using Dilated(TimeSpan)!

    Declaration
    public object PeekOne(TimeSpan? max = null, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    TimeSpan? max

    The maximum duration to wait. If null the config value "akka.test.single-expect-default" is used as timeout. If set to a negative value or InfiniteTimeSpan, blocks forever. This method does NOT automatically scale its Duration parameter using Dilated(TimeSpan)!

    CancellationToken cancellationToken
    Returns
    Type Description
    object

    The message if one was received; null otherwise

    | Edit this page View Source

    PeekOne(CancellationToken)

    Peek one message from the head of the internal queue of the TestActor. This method blocks until cancelled.

    Declaration
    public object PeekOne(CancellationToken cancellationToken)
    Parameters
    Type Name Description
    CancellationToken cancellationToken

    A token used to cancel the operation

    Returns
    Type Description
    object

    The message if one was received; null otherwise

    | Edit this page View Source

    PeekOneAsync(TimeSpan?, CancellationToken)

    Peek one message from the head of the internal queue of the TestActor. This method blocks the specified duration or until a message is received. If no message was received, null is returned. This method does NOT automatically scale its Duration parameter using Dilated(TimeSpan)!

    Declaration
    public ValueTask<object> PeekOneAsync(TimeSpan? max = null, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    TimeSpan? max

    The maximum duration to wait. If null the config value "akka.test.single-expect-default" is used as timeout. If set to a negative value or InfiniteTimeSpan, blocks forever. This method does NOT automatically scale its Duration parameter using Dilated(TimeSpan)!

    CancellationToken cancellationToken
    Returns
    Type Description
    ValueTask<object>

    The message if one was received; null otherwise

    | Edit this page View Source

    PeekOneAsync(CancellationToken)

    Peek one message from the head of the internal queue of the TestActor. This method blocks until cancelled.

    Declaration
    public ValueTask<object> PeekOneAsync(CancellationToken cancellationToken)
    Parameters
    Type Name Description
    CancellationToken cancellationToken

    A token used to cancel the operation

    Returns
    Type Description
    ValueTask<object>

    The message if one was received; null otherwise

    | Edit this page View Source

    ReceiveN(int, CancellationToken)

    Receive the specified number of messages using RemainingOrDefault as timeout.

    Declaration
    public IReadOnlyCollection<object> ReceiveN(int numberOfMessages, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    int numberOfMessages

    The number of messages.

    CancellationToken cancellationToken
    Returns
    Type Description
    IReadOnlyCollection<object>

    The received messages

    | Edit this page View Source

    ReceiveN(int, TimeSpan, CancellationToken)

    Receive the specified number of messages in a row before the given deadline. The deadline is scaled by "akka.test.timefactor" using Dilated(TimeSpan).

    Declaration
    public IReadOnlyCollection<object> ReceiveN(int numberOfMessages, TimeSpan max, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    int numberOfMessages

    The number of messages.

    TimeSpan max

    The timeout scaled by "akka.test.timefactor" using Dilated(TimeSpan).

    CancellationToken cancellationToken
    Returns
    Type Description
    IReadOnlyCollection<object>

    The received messages

    | Edit this page View Source

    ReceiveNAsync(int, CancellationToken)

    Receive the specified number of messages using RemainingOrDefault as timeout.

    Declaration
    public IAsyncEnumerable<object> ReceiveNAsync(int numberOfMessages, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    int numberOfMessages

    The number of messages.

    CancellationToken cancellationToken
    Returns
    Type Description
    IAsyncEnumerable<object>

    The received messages

    | Edit this page View Source

    ReceiveNAsync(int, TimeSpan, CancellationToken)

    Receive the specified number of messages in a row before the given deadline. The deadline is scaled by "akka.test.timefactor" using Dilated(TimeSpan).

    Declaration
    public IAsyncEnumerable<object> ReceiveNAsync(int numberOfMessages, TimeSpan max, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    int numberOfMessages

    The number of messages.

    TimeSpan max

    The timeout scaled by "akka.test.timefactor" using Dilated(TimeSpan).

    CancellationToken cancellationToken
    Returns
    Type Description
    IAsyncEnumerable<object>

    The received messages

    | Edit this page View Source

    ReceiveOne(TimeSpan?, CancellationToken)

    Receive one message from the internal queue of the TestActor. This method blocks the specified duration or until a message is received. If no message was received, null is returned. This method does NOT automatically scale its Duration parameter using Dilated(TimeSpan)!

    Declaration
    public object ReceiveOne(TimeSpan? max = null, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    TimeSpan? max

    The maximum duration to wait. If null the config value "akka.test.single-expect-default" is used as timeout. If set to a negative value or InfiniteTimeSpan, blocks forever. This method does NOT automatically scale its Duration parameter using Dilated(TimeSpan)!

    CancellationToken cancellationToken
    Returns
    Type Description
    object

    The message if one was received; null otherwise

    | Edit this page View Source

    ReceiveOneAsync(TimeSpan?, CancellationToken)

    Receive one message from the internal queue of the TestActor. This method blocks the specified duration or until a message is received. If no message was received, null is returned. This method does NOT automatically scale its Duration parameter using Dilated(TimeSpan)!

    Declaration
    public ValueTask<object> ReceiveOneAsync(TimeSpan? max = null, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    TimeSpan? max

    The maximum duration to wait. If null the config value "akka.test.single-expect-default" is used as timeout. If set to a negative value or InfiniteTimeSpan, blocks forever. This method does NOT automatically scale its Duration parameter using Dilated(TimeSpan)!

    CancellationToken cancellationToken
    Returns
    Type Description
    ValueTask<object>

    The message if one was received; null otherwise

    | Edit this page View Source

    ReceiveWhileAsync<T>(Func<object, T>, TimeSpan?, TimeSpan?, int, CancellationToken)

    Receive a series of messages until the function returns null or the idle timeout is met (disabled by default) or the overall maximum duration is elapsed or expected messages count is reached. Returns the sequence of messages.

    Note that it is not an error to hit the max duration in this case. The max duration is scaled by Dilated(TimeSpan)

    Declaration
    public IAsyncEnumerable<T> ReceiveWhileAsync<T>(Func<object, T> filter, TimeSpan? max = null, TimeSpan? idle = null, int msgs = 2147483647, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    Func<object, T> filter

    TBD

    TimeSpan? max

    TBD

    TimeSpan? idle

    TBD

    int msgs

    TBD

    CancellationToken cancellationToken
    Returns
    Type Description
    IAsyncEnumerable<T>

    TBD

    Type Parameters
    Name Description
    T

    TBD

    | Edit this page View Source

    ReceiveWhileAsync<T>(TimeSpan?, Func<object, T>, int, CancellationToken)

    Receive a series of messages until the function returns null or the overall maximum duration is elapsed or expected messages count is reached. Returns the sequence of messages.

    Note that it is not an error to hit the max duration in this case. The max duration is scaled by Dilated(TimeSpan)

    Declaration
    public IAsyncEnumerable<T> ReceiveWhileAsync<T>(TimeSpan? max, Func<object, T> filter, int msgs = 2147483647, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    TimeSpan? max

    TBD

    Func<object, T> filter

    TBD

    int msgs

    TBD

    CancellationToken cancellationToken
    Returns
    Type Description
    IAsyncEnumerable<T>

    TBD

    Type Parameters
    Name Description
    T

    TBD

    | Edit this page View Source

    ReceiveWhileAsync<T>(TimeSpan?, TimeSpan?, Func<object, T>, int, CancellationToken)

    Receive a series of messages until the function returns null or the idle timeout is met or the overall maximum duration is elapsed or expected messages count is reached. Returns the sequence of messages.

    Note that it is not an error to hit the max duration in this case. The max duration is scaled by Dilated(TimeSpan)

    Declaration
    public IAsyncEnumerable<T> ReceiveWhileAsync<T>(TimeSpan? max, TimeSpan? idle, Func<object, T> filter, int msgs = 2147483647, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    TimeSpan? max

    TBD

    TimeSpan? idle

    TBD

    Func<object, T> filter

    TBD

    int msgs

    TBD

    CancellationToken cancellationToken
    Returns
    Type Description
    IAsyncEnumerable<T>

    TBD

    Type Parameters
    Name Description
    T

    TBD

    | Edit this page View Source

    ReceiveWhileAsync<T>(Predicate<T>, TimeSpan?, TimeSpan?, int, bool, CancellationToken)

    Receive a series of messages. It will continue to receive messages until the shouldContinue predicate returns false or the idle timeout is met (disabled by default) or the overall maximum duration is elapsed or expected messages count is reached. If a message that isn't of type T the parameter shouldIgnoreOtherMessageTypes declares if the message should be ignored or not.

    Returns the sequence of messages.

    Note that it is not an error to hit the max duration in this case. The max duration is scaled by Dilated(TimeSpan)

    Declaration
    public IAsyncEnumerable<T> ReceiveWhileAsync<T>(Predicate<T> shouldContinue, TimeSpan? max = null, TimeSpan? idle = null, int msgs = 2147483647, bool shouldIgnoreOtherMessageTypes = true, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    Predicate<T> shouldContinue

    TBD

    TimeSpan? max

    TBD

    TimeSpan? idle

    TBD

    int msgs

    TBD

    bool shouldIgnoreOtherMessageTypes

    TBD

    CancellationToken cancellationToken
    Returns
    Type Description
    IAsyncEnumerable<T>

    TBD

    Type Parameters
    Name Description
    T

    TBD

    | Edit this page View Source

    ReceiveWhile<T>(Func<object, T>, TimeSpan?, TimeSpan?, int, CancellationToken)

    Receive a series of messages until the function returns null or the idle timeout is met (disabled by default) or the overall maximum duration is elapsed or expected messages count is reached. Returns the sequence of messages.

    Note that it is not an error to hit the max duration in this case. The max duration is scaled by Dilated(TimeSpan)

    Declaration
    public IReadOnlyList<T> ReceiveWhile<T>(Func<object, T> filter, TimeSpan? max = null, TimeSpan? idle = null, int msgs = 2147483647, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    Func<object, T> filter

    TBD

    TimeSpan? max

    TBD

    TimeSpan? idle

    TBD

    int msgs

    TBD

    CancellationToken cancellationToken
    Returns
    Type Description
    IReadOnlyList<T>

    TBD

    Type Parameters
    Name Description
    T

    TBD

    | Edit this page View Source

    ReceiveWhile<T>(TimeSpan?, Func<object, T>, int, CancellationToken)

    Receive a series of messages until the function returns null or the overall maximum duration is elapsed or expected messages count is reached. Returns the sequence of messages.

    Note that it is not an error to hit the max duration in this case. The max duration is scaled by Dilated(TimeSpan)

    Declaration
    public IReadOnlyList<T> ReceiveWhile<T>(TimeSpan? max, Func<object, T> filter, int msgs = 2147483647, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    TimeSpan? max

    TBD

    Func<object, T> filter

    TBD

    int msgs

    TBD

    CancellationToken cancellationToken
    Returns
    Type Description
    IReadOnlyList<T>

    TBD

    Type Parameters
    Name Description
    T

    TBD

    | Edit this page View Source

    ReceiveWhile<T>(TimeSpan?, TimeSpan?, Func<object, T>, int, CancellationToken)

    Receive a series of messages until the function returns null or the idle timeout is met or the overall maximum duration is elapsed or expected messages count is reached. Returns the sequence of messages.

    Note that it is not an error to hit the max duration in this case. The max duration is scaled by Dilated(TimeSpan)

    Declaration
    public IReadOnlyList<T> ReceiveWhile<T>(TimeSpan? max, TimeSpan? idle, Func<object, T> filter, int msgs = 2147483647, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    TimeSpan? max

    TBD

    TimeSpan? idle

    TBD

    Func<object, T> filter

    TBD

    int msgs

    TBD

    CancellationToken cancellationToken
    Returns
    Type Description
    IReadOnlyList<T>

    TBD

    Type Parameters
    Name Description
    T

    TBD

    | Edit this page View Source

    ReceiveWhile<T>(Predicate<T>, TimeSpan?, TimeSpan?, int, bool, CancellationToken)

    Receive a series of messages. It will continue to receive messages until the shouldContinue predicate returns false or the idle timeout is met (disabled by default) or the overall maximum duration is elapsed or expected messages count is reached. If a message that isn't of type T the parameter shouldIgnoreOtherMessageTypes declares if the message should be ignored or not.

    Returns the sequence of messages.

    Note that it is not an error to hit the max duration in this case. The max duration is scaled by Dilated(TimeSpan)

    Declaration
    public IReadOnlyList<T> ReceiveWhile<T>(Predicate<T> shouldContinue, TimeSpan? max = null, TimeSpan? idle = null, int msgs = 2147483647, bool shouldIgnoreOtherMessageTypes = true, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    Predicate<T> shouldContinue

    TBD

    TimeSpan? max

    TBD

    TimeSpan? idle

    TBD

    int msgs

    TBD

    bool shouldIgnoreOtherMessageTypes

    TBD

    CancellationToken cancellationToken
    Returns
    Type Description
    IReadOnlyList<T>

    TBD

    Type Parameters
    Name Description
    T

    TBD

    | Edit this page View Source

    RemainingOr(TimeSpan)

    If inside a within block obtain time remaining for execution of the innermost enclosing within block; otherwise returns the given duration.

    Declaration
    protected TimeSpan RemainingOr(TimeSpan duration)
    Parameters
    Type Name Description
    TimeSpan duration

    TBD

    Returns
    Type Description
    TimeSpan

    TBD

    Exceptions
    Type Condition
    ArgumentException

    TBD

    | Edit this page View Source

    RemainingOrDilated(TimeSpan?)

    If duration is finite it is returned after it has been scaled using Dilated(TimeSpan). If duration is undefined, it returns the remaining time (if within a within block) or the properly dilated default from settings (key "akka.test.single-expect-default"). If duration is infinite, an ArgumentException is thrown. The returned value is always finite.

    Declaration
    public TimeSpan RemainingOrDilated(TimeSpan? duration)
    Parameters
    Type Name Description
    TimeSpan? duration

    The maximum.

    Returns
    Type Description
    TimeSpan

    A finite TimeSpan properly dilated

    Exceptions
    Type Condition
    ArgumentException

    Thrown if duration is infinite

    | Edit this page View Source

    SetAutoPilot(AutoPilot)

    Install an AutoPilot to drive the TestActor. The AutoPilot will be run for each received message and can be used to send or forward messages, etc.

    Each invocation must return the AutoPilot for the next round. To reuse the same AutoPilot return KeepRunning.

    Declaration
    public void SetAutoPilot(AutoPilot pilot)
    Parameters
    Type Name Description
    AutoPilot pilot

    The pilot to install.

    | Edit this page View Source

    Shutdown(ActorSystem, TimeSpan?, bool)

    Shuts down the specified system. On failure debug output will be logged about the remaining actors in the system. If verifySystemShutdown is true, then an exception will be thrown on failure.

    Declaration
    protected virtual void Shutdown(ActorSystem system, TimeSpan? duration = null, bool verifySystemShutdown = false)
    Parameters
    Type Name Description
    ActorSystem system

    The system to shutdown.

    TimeSpan? duration

    The duration to wait for shutdown. Default is 5 seconds multiplied with the config value "akka.test.timefactor"

    bool verifySystemShutdown

    if set to true an exception will be thrown on failure.

    Exceptions
    Type Condition
    TimeoutException

    TBD

    | Edit this page View Source

    Shutdown(TimeSpan?, bool)

    Shuts down this system. On failure debug output will be logged about the remaining actors in the system. If verifySystemShutdown is true, then an exception will be thrown on failure.

    Declaration
    public virtual void Shutdown(TimeSpan? duration = null, bool verifySystemShutdown = false)
    Parameters
    Type Name Description
    TimeSpan? duration

    Optional. The duration to wait for shutdown. Default is 5 seconds multiplied with the config value "akka.test.timefactor".

    bool verifySystemShutdown

    if set to true an exception will be thrown on failure.

    Exceptions
    Type Condition
    TimeoutException

    TBD

    | Edit this page View Source

    TryPeekOne(out MessageEnvelope, TimeSpan?, CancellationToken)

    Peek one message from the head of the internal queue of the TestActor within the specified duration.

    True is returned if a message existed, and the message is returned in envelope. The method blocks the specified duration, and can be cancelled using the cancellationToken.

    This method does NOT automatically scale its duration parameter using Dilated(TimeSpan)!
    Declaration
    public bool TryPeekOne(out MessageEnvelope envelope, TimeSpan? max, CancellationToken cancellationToken)
    Parameters
    Type Name Description
    MessageEnvelope envelope

    The received envelope.

    TimeSpan? max

    The maximum duration to wait. If null the config value "akka.test.single-expect-default" is used as timeout. If set to InfiniteTimeSpan, blocks forever (or until cancelled). This method does NOT automatically scale its Duration parameter using Dilated(TimeSpan)!

    CancellationToken cancellationToken

    A token used to cancel the operation.

    Returns
    Type Description
    bool

    True if a message was received within the specified duration; false otherwise.

    | Edit this page View Source

    TryPeekOneAsync(TimeSpan?, CancellationToken)

    Peek one message from the head of the internal queue of the TestActor within the specified duration.

    True is returned if a message existed, and the message is returned in envelope. The method blocks the specified duration, and can be cancelled using the cancellationToken.

    This method does NOT automatically scale its duration parameter using Dilated(TimeSpan)!
    Declaration
    public ValueTask<(bool success, MessageEnvelope envelope)> TryPeekOneAsync(TimeSpan? max, CancellationToken cancellationToken)
    Parameters
    Type Name Description
    TimeSpan? max

    The maximum duration to wait. If null the config value "akka.test.single-expect-default" is used as timeout. If set to InfiniteTimeSpan, blocks forever (or until cancelled). This method does NOT automatically scale its Duration parameter using Dilated(TimeSpan)!

    CancellationToken cancellationToken

    A token used to cancel the operation.

    Returns
    Type Description
    ValueTask<(bool success, MessageEnvelope envelope)>

    True if a message was received within the specified duration; false otherwise.

    | Edit this page View Source

    TryReceiveOne(out MessageEnvelope, TimeSpan?, CancellationToken)

    Receive one message from the internal queue of the TestActor within the specified duration. The method blocks the specified duration. Note! that the returned envelope is a MessageEnvelope containing the sender and the message. This method does NOT automatically scale its Duration parameter using Dilated(TimeSpan)!

    Declaration
    public bool TryReceiveOne(out MessageEnvelope envelope, TimeSpan? max = null, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    MessageEnvelope envelope

    The received envelope.

    TimeSpan? max

    Optional: The maximum duration to wait. If null the config value "akka.test.single-expect-default" is used as timeout. If set to a negative value or InfiniteTimeSpan, blocks forever. This method does NOT automatically scale its Duration parameter using Dilated(TimeSpan)!

    CancellationToken cancellationToken
    Returns
    Type Description
    bool

    True if a message was received within the specified duration; false otherwise.

    | Edit this page View Source

    TryReceiveOneAsync(TimeSpan?, CancellationToken)

    Receive one message from the internal queue of the TestActor within the specified duration. The method blocks the specified duration. Note! that the returned envelope is a MessageEnvelope containing the sender and the message. This method does NOT automatically scale its Duration parameter using Dilated(TimeSpan)!

    Declaration
    public ValueTask<(bool success, MessageEnvelope envelope)> TryReceiveOneAsync(TimeSpan? max, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    TimeSpan? max

    Optional: The maximum duration to wait. If null the config value "akka.test.single-expect-default" is used as timeout. If set to a negative value or InfiniteTimeSpan, blocks forever. This method does NOT automatically scale its Duration parameter using Dilated(TimeSpan)!

    CancellationToken cancellationToken
    Returns
    Type Description
    ValueTask<(bool success, MessageEnvelope envelope)>

    True if a message was received within the specified duration; false otherwise.

    | Edit this page View Source

    Unwatch(IActorRef)

    Have the TestActor stop watching an actor.

    Declaration
    public IActorRef Unwatch(IActorRef actorToUnwatch)
    Parameters
    Type Name Description
    IActorRef actorToUnwatch

    The actor to unwatch.

    Returns
    Type Description
    IActorRef

    The actor to unwatch, i.e. the parameter actorToUnwatch

    | Edit this page View Source

    UnwatchAsync(IActorRef)

    Have the TestActor stop watching an actor.

    Declaration
    public Task<IActorRef> UnwatchAsync(IActorRef actorToUnwatch)
    Parameters
    Type Name Description
    IActorRef actorToUnwatch

    The actor to unwatch.

    Returns
    Type Description
    Task<IActorRef>

    The actor to unwatch, i.e. the parameter actorToUnwatch

    Remarks

    This method exists in order to make the asynchronous nature of the Unwatch method explicit.

    | Edit this page View Source

    WaitForRadioSilenceAsync(TimeSpan?, uint?, CancellationToken)

    Waits for a max period of 'radio-silence' limited to a number of maxMessages. Note: 'radio-silence' definition: period when no messages arrive at.

    Declaration
    public Task<ArrayList> WaitForRadioSilenceAsync(TimeSpan? max = null, uint? maxMessages = null, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    TimeSpan? max

    A temporary period of 'radio-silence'.

    uint? maxMessages

    The method asserts that maxMessages is never reached.

    CancellationToken cancellationToken
    Returns
    Type Description
    Task<ArrayList>

    Returns all the messages encountered before 'radio-silence' was reached.

    | Edit this page View Source

    Watch(IActorRef)

    Have the TestActor watch an actor and receive Terminated messages when the actor terminates.

    Declaration
    public IActorRef Watch(IActorRef actorToWatch)
    Parameters
    Type Name Description
    IActorRef actorToWatch

    The actor to watch.

    Returns
    Type Description
    IActorRef

    The actor to watch, i.e. the parameter actorToWatch

    | Edit this page View Source

    WatchAsync(IActorRef)

    Have the TestActor watch an actor and receive Terminated messages when the actor terminates.

    Declaration
    public Task<IActorRef> WatchAsync(IActorRef actorToWatch)
    Parameters
    Type Name Description
    IActorRef actorToWatch

    The actor to watch.

    Returns
    Type Description
    Task<IActorRef>

    The actor to watch, i.e. the parameter actorToWatch

    Remarks

    This method exists in order to make the asynchronous nature of the Watch method explicit.

    | Edit this page View Source

    Within(TimeSpan, Action, TimeSpan?, CancellationToken)

    Execute code block while bounding its execution time between 0 seconds and max.

    `within` blocks may be nested. All methods in this class which take maximum wait times are available in a version which implicitly uses the remaining time governed by the innermost enclosing `within` block.

    Note that the max duration is scaled using Dilated(TimeSpan) which uses the config value "akka.test.timefactor"
    Declaration
    public void Within(TimeSpan max, Action action, TimeSpan? epsilonValue = null, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    TimeSpan max

    TBD

    Action action

    TBD

    TimeSpan? epsilonValue

    TBD

    CancellationToken cancellationToken
    | Edit this page View Source

    Within(TimeSpan, TimeSpan, Action, string, TimeSpan?, CancellationToken)

    Execute code block while bounding its execution time between min and max.

    `within` blocks may be nested. All methods in this class which take maximum wait times are available in a version which implicitly uses the remaining time governed by the innermost enclosing `within` block.

    Note that the max duration is scaled using Dilated(TimeSpan) which uses the config value "akka.test.timefactor"
    Declaration
    public void Within(TimeSpan min, TimeSpan max, Action action, string hint = null, TimeSpan? epsilonValue = null, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    TimeSpan min

    TBD

    TimeSpan max

    TBD

    Action action

    TBD

    string hint

    TBD

    TimeSpan? epsilonValue

    TBD

    CancellationToken cancellationToken
    | Edit this page View Source

    WithinAsync(TimeSpan, Func<Task>, TimeSpan?, CancellationToken)

    Async version of Within(TimeSpan, Action, TimeSpan?, CancellationToken) that takes a Func<TResult> instead of an Action

    Declaration
    public Task WithinAsync(TimeSpan max, Func<Task> actionAsync, TimeSpan? epsilonValue = null, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    TimeSpan max
    Func<Task> actionAsync
    TimeSpan? epsilonValue
    CancellationToken cancellationToken
    Returns
    Type Description
    Task
    | Edit this page View Source

    WithinAsync(TimeSpan, TimeSpan, Func<Task>, string, TimeSpan?, CancellationToken)

    Async version of Within(TimeSpan, TimeSpan, Action, string, TimeSpan?, CancellationToken) that takes a Func<TResult> instead of an Action

    Declaration
    public Task WithinAsync(TimeSpan min, TimeSpan max, Func<Task> actionAsync, string hint = null, TimeSpan? epsilonValue = null, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    TimeSpan min
    TimeSpan max
    Func<Task> actionAsync
    string hint
    TimeSpan? epsilonValue
    CancellationToken cancellationToken
    Returns
    Type Description
    Task
    | Edit this page View Source

    WithinAsync<T>(TimeSpan, Func<Task<T>>, TimeSpan?, CancellationToken)

    Execute code block while bounding its execution time between 0 seconds and max.

    `within` blocks may be nested. All methods in this class which take maximum wait times are available in a version which implicitly uses the remaining time governed by the innermost enclosing `within` block.

    Note that the max duration is scaled using Dilated(TimeSpan) which uses the config value "akka.test.timefactor"
    Declaration
    public Task<T> WithinAsync<T>(TimeSpan max, Func<Task<T>> function, TimeSpan? epsilonValue = null, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    TimeSpan max

    TBD

    Func<Task<T>> function

    TBD

    TimeSpan? epsilonValue

    TBD

    CancellationToken cancellationToken
    Returns
    Type Description
    Task<T>

    TBD

    Type Parameters
    Name Description
    T

    TBD

    | Edit this page View Source

    WithinAsync<T>(TimeSpan, TimeSpan, Func<Task<T>>, string, TimeSpan?, CancellationToken)

    Execute code block while bounding its execution time between min and max.

    `within` blocks may be nested. All methods in this class which take maximum wait times are available in a version which implicitly uses the remaining time governed by the innermost enclosing `within` block.

    Note that the max duration is scaled using Dilated(TimeSpan) which uses the config value "akka.test.timefactor".

    Note that due to how asynchronous Task is executed in managed code, there is no way to stop a running Task. If this assertion fails in any way, the function Task might still be running in the background and might not be stopped/disposed until the unit test is over.

    Declaration
    public Task<T> WithinAsync<T>(TimeSpan min, TimeSpan max, Func<Task<T>> function, string hint = null, TimeSpan? epsilonValue = null, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    TimeSpan min

    TBD

    TimeSpan max

    TBD

    Func<Task<T>> function

    TBD

    string hint

    TBD

    TimeSpan? epsilonValue

    TBD

    CancellationToken cancellationToken
    Returns
    Type Description
    Task<T>

    TBD

    Type Parameters
    Name Description
    T

    TBD

    | Edit this page View Source

    Within<T>(TimeSpan, Func<T>, TimeSpan?, CancellationToken)

    Execute code block while bounding its execution time between 0 seconds and max.

    `within` blocks may be nested. All methods in this class which take maximum wait times are available in a version which implicitly uses the remaining time governed by the innermost enclosing `within` block.

    Note that the max duration is scaled using Dilated(TimeSpan) which uses the config value "akka.test.timefactor"
    Declaration
    public T Within<T>(TimeSpan max, Func<T> function, TimeSpan? epsilonValue = null, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    TimeSpan max

    TBD

    Func<T> function

    TBD

    TimeSpan? epsilonValue

    TBD

    CancellationToken cancellationToken
    Returns
    Type Description
    T

    TBD

    Type Parameters
    Name Description
    T

    TBD

    | Edit this page View Source

    Within<T>(TimeSpan, TimeSpan, Func<T>, string, TimeSpan?, CancellationToken)

    Execute code block while bounding its execution time between min and max.

    `within` blocks may be nested. All methods in this class which take maximum wait times are available in a version which implicitly uses the remaining time governed by the innermost enclosing `within` block.

    Note that the max duration is scaled using Dilated(TimeSpan) which uses the config value "akka.test.timefactor"
    Declaration
    public T Within<T>(TimeSpan min, TimeSpan max, Func<T> function, string hint = null, TimeSpan? epsilonValue = null, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    TimeSpan min

    TBD

    TimeSpan max

    TBD

    Func<T> function

    TBD

    string hint

    TBD

    TimeSpan? epsilonValue

    TBD

    CancellationToken cancellationToken
    Returns
    Type Description
    T

    TBD

    Type Parameters
    Name Description
    T

    TBD

    Implements

    IActorRefFactory

    Extension Methods

    ActorRefFactoryExtensions.ActorOf<TActor>(IActorRefFactory, string)
    ActorRefFactoryExtensions.ActorSelection(IActorRefFactory, IActorRef, string)
    ActExtensions.ActorOf(IActorRefFactory, Action<IActorDsl, IActorContext>, string)
    ActExtensions.ActorOf(IActorRefFactory, Action<IActorDsl>, string)
    ActorMaterializerExtensions.Materializer(IActorRefFactory, ActorMaterializerSettings, string)
    TestPublisher.CreateManualPublisherProbe<T>(TestKitBase, bool)
    TestPublisher.CreatePublisherProbe<T>(TestKitBase, long)
    TestSink.SinkProbe<T>(TestKitBase)
    TestSource.SourceProbe<T>(TestKitBase)
    TestSubscriber.CreateManualSubscriberProbe<T>(TestKitBase)
    TestSubscriber.CreateSubscriberProbe<T>(TestKitBase)
    Utils.AssertAllStagesStopped(TestKitBase, Action, IMaterializer, TimeSpan?, CancellationToken)
    Utils.AssertAllStagesStoppedAsync(TestKitBase, Func<Task>, IMaterializer, TimeSpan?, CancellationToken)
    Utils.AssertAllStagesStoppedAsync<T>(TestKitBase, Func<Task<T>>, IMaterializer, TimeSpan?, CancellationToken)
    Utils.AssertAllStagesStopped<T>(TestKitBase, Func<T>, IMaterializer, TimeSpan?, CancellationToken)
    ObjectExtensions.IsDefaultForType<T>(T)
    ObjectExtensions.AsOption<T>(T)
    Extensions.AsInstanceOf<T>(object)
    In this article
    • githubEdit this page
    • View Source
    Back to top
    Contribute
    • Project Chat
    • Discussion Forum
    • Source Code
    Support
    • Akka.NET Support Plans
    • Akka.NET Observability Tools
    • Akka.NET Training & Consulting
    Maintained By
    • Petabridge - The Akka.NET Company
    • Learn Akka.NET