Search Results for

    Show / Hide Table of Contents

    Namespace Akka.TestKit

    Classes

    AutoPilot

    Creates an AutoPilot.

    An AutoPilot will be called 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 an AutoPilot for the next message either return the instance or return KeepRunning.

    Return NoAutoPilot to stop handling messages.

    CallingThreadDispatcher

    INTERNAL API

    Used to run an actor on the foreground thread.

    CallingThreadDispatcherConfigurator

    INTERNAL API

    DeadLettersFilter

    Filter which matches DeadLetter events, if the wrapped message conforms to the given type.

    DelegateAutoPilot

    Creates an AutoPilot.

    The AutoPilotDelegate specified in the constructor will be called 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 have this instance handle the next message either return this instance or return KeepRunning.

    Return NoAutoPilot to stop handling messages.

    DelegatingSupervisorStrategy

    EventFilterFactory

    TBD

    FSMSpecHelpers

    TBD

    KeepRunning

    When returned by another AutoPilot then TestActor will reuse the AutoPilot for the next message.

    MessageEnvelope

    TBD

    NoAutoPilot

    When returned by another AutoPilot then no action will be performed by the TestActor for the next message. This is the default AutoPilot used by AutoPilot.

    NullMessageEnvelope

    TBD

    PredicateInfo

    PredicateInfoFactory

    RealMessageEnvelope

    TBD

    TestActor

    TBD

    TestActor.SetAutoPilot

    Message that is supposed to be sent to a TestActor to 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.

    TestActor.SetIgnore

    Message that is supposed to be sent to a TestActor to make it ignore received messages. If the delegate specified on the constructor returns true the message will be ignored by TestActor

    TestActor.Spawn

    Message which is intended to allow TestKit to spawn a child actor

    TestActor.Unwatch

    Message that is supposed to be sent to a TestActor to make it unwatch a previously watched actor.

    TestActor.Watch

    Message that is supposed to be sent to a TestActor to make it watch the specified actor and receive death notifications, i.e. Terminated messages.

    TestActorRefBase<TActor>

    This is the base class for TestActorRefs

    TestActorRef<TActor>

    This special ActorRef is exclusively for use during unit testing in a single-threaded environment. Therefore, it overrides the dispatcher to CallingThreadDispatcher and sets the receiveTimeout to None. Otherwise, it acts just like a normal ActorRef. You may retrieve a reference to the underlying actor to test internal logic. A TestActorRef<TActor> can be implicitly casted to an IActorRef or you can get the actual IActorRef from the Ref property.

    TestBarrier

    Wraps a Barrier for use in testing. It always uses a timeout when waiting. Timeouts will always throw an exception. The default timeout is based on TestKits default out, see DefaultTimeout.

    TestBreaker

    TBD

    TestEventListener

    EventListener for running tests, which allows selectively filtering out expected messages. To use it, include something like this in the configuration:

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

    TestFSMRef<TActor, TState, TData>

    This is a specialized form of the TestActorRef<TActor> with support for querying and setting the state of a FSM<TState, TData>.

    TestKitAssertionsExtension

    TBD

    TestKitAssertionsProvider

    Contains ITestKitAssertions.

    TestKitBase

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

    TestKitExtension

    A extension to be used together with the TestKit. To get the settings:

    var testKitSettings = TestKitExtension.For(system);

    TestKitSettings

    Contains settings to be used when writing tests with TestKit.

    TestLatch

    A count down latch that initially is closed. In order for it to become open CountDown() must be called. By default one call is enough, but this can be changed by specifying the count in the constructor.

    By default a timeout of 5 seconds is used.

    When created using TestKit.CreateTestLatch the default timeout from DefaultTimeout is used and all timeouts are dilated, i.e. multiplied by TestTimeFactor

    Timeouts will always throw an exception.

    TestProbe

    TestKit-based probe which allows sending, reception and reply. Use CreateTestProbe(string) inside your test to create new instances.

    TestScheduler

    TBD

    Interfaces

    IEventFilter

    TBD

    IEventFilterApplier

    TBD

    INoImplicitSender

    Normally test classes has TestActor as implicit sender. So when no sender is specified when sending messages, TestActor is used. When a a test class implements INoImplicitSender this behavior is removed and the normal behavior is restored, i.e. NoSender is used as sender when no sender has been specified.

    public class WithImplicitSender : TestKit
    {
       public void TheTestMethod()
       {
          ...
          someActor.Tell("message");             //TestActor is used as Sender
          someActor.Tell("message", TestActor);  //TestActor is used as Sender
       }
    }
    
    public class WithNoImplicitSender : TestKit, INoImplicitSender
    {
       public void TheTestMethod()
       {
          ...
          someActor.Tell("message");    //ActorRefs.NoSender is used as Sender
       }
    }

    ITestKitAssertions

    This interface defines several common assert patterns used in the various testkits.

    IUnmutableFilter

    TBD

    Delegates

    AutoPilotDelegate

    TBD

    TestActor.Ignore

    A delegate that returns true if the message should be ignored.

    In this article
    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