Click or drag to resize
Akka.NETAkka.TestKit Namespace
The Akka.TestKit namespace contains classes that provide base testing functionality used by the different testkit extensions. This functionality allows for writing tests in the extension's framework.
Classes
  ClassDescription
Public classAkkaSpecExtensions
TBD
Public classAutoPilot
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.

Public classCallingThreadDispatcher
TBD
Public classCallingThreadDispatcherConfigurator
TBD
Public classDeadLettersFilter
Filter which matches DeadLetter events, if the wrapped message conforms to the given type.
Public classDelegateAutoPilot
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.

Public classEventFilterFactory
TBD
Public classFSMSpecHelpers
TBD
Public classKeepRunning
When returned by another AutoPilot then TestActor will reuse the AutoPilot for the next message.
Public classMessageEnvelope
TBD
Public classNoAutoPilot
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.
Public classNullMessageEnvelope
TBD
Public classRealMessageEnvelope
TBD
Public classTestActor
TBD
Public classTestActorSetAutoPilot
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.
Public classTestActorSetIgnore
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
Public classTestActorUnwatch
Message that is supposed to be sent to a TestActor to make it unwatch a previously watched actor.
Public classTestActorWatch
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.
Public classTestActorRefTActor
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 TestActorRefTActor can be implicitly casted to an IActorRef or you can get the actual IActorRef from the Ref property.
Public classTestActorRefBaseTActor
This is the base class for TestActorRefs
Public classTestBarrier
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.
Public classTestBreaker
TBD
Public classTestEventListener
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"]
Public classTestFSMRefTActor, TState, TData
Public classTestKitAssertionsExtension
TBD
Public classTestKitAssertionsProvider
Contains ITestKitAssertions.
Public classTestKitBase
Remarks
Unless you're creating a TestKit for a specific test framework, you should probably not inherit directly from this class.
Public classCode exampleTestKitExtension
A extension to be used together with the TestKit.
Examples
To get the settings:
var testKitSettings = TestKitExtension.For(system);
Public classTestKitSettings
Contains settings to be used when writing tests with TestKit.
Public classTestLatch

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.
Public classTestProbe
TestKit-based probe which allows sending, reception and reply. Use CreateTestProbe(String) inside your test to create new instances.
Public classTestScheduler
TBD
Interfaces
  InterfaceDescription
Public interfaceIEventFilter
TBD
Public interfaceIEventFilterApplier
TBD
Public interfaceCode exampleINoImplicitSender
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.
Examples
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
   }
}
Public interfaceITestKitAssertions
TBD
Public interfaceIUnmutableFilter
TBD
Delegates
  DelegateDescription
Public delegateAutoPilotDelegate
TBD
Public delegateTestActorIgnore
A delegate that returns true if the message should be ignored.