Class TestProbe
TestKit-based probe which allows sending, reception and reply. Use CreateTestProbe(string) inside your test to create new instances.
Implements
Inherited Members
Namespace: Akka.TestKit
Assembly: Akka.TestKit.dll
Syntax
public class TestProbe : TestKitBase, IActorRefFactory, INoImplicitSender, IActorRef, ICanTell, IEquatable<IActorRef>, IComparable<IActorRef>, ISurrogated, IComparable
Constructors
| Edit this page View SourceTestProbe(ActorSystem, ITestKitAssertions, string)
TBD
Declaration
public TestProbe(ActorSystem system, ITestKitAssertions assertions, string testProbeName = null)
Parameters
| Type | Name | Description |
|---|---|---|
| ActorSystem | system | TBD |
| ITestKitAssertions | assertions | TBD |
| string | testProbeName | TBD |
Properties
| Edit this page View SourceRef
Gets the reference of this probe.
Declaration
public IActorRef Ref { get; }
Property Value
| Type | Description |
|---|---|
| IActorRef |
Sender
Gets the sender of the last message
Declaration
public IActorRef Sender { get; }
Property Value
| Type | Description |
|---|---|
| IActorRef |
Methods
| Edit this page View SourceChildActorOfAsync<T>(SupervisorStrategy, CancellationToken)
Spawns an actor as a child of this test actor, and returns the child's ActorRef.
Declaration
public Task<IActorRef> ChildActorOfAsync<T>(SupervisorStrategy supervisorStrategy, CancellationToken cancellationToken = default) where T : ActorBase
Parameters
| Type | Name | Description |
|---|---|---|
| SupervisorStrategy | supervisorStrategy | |
| CancellationToken | cancellationToken | CancellationToken to cancel the operation |
Returns
| Type | Description |
|---|---|
| Task<IActorRef> |
Type Parameters
| Name | Description |
|---|---|
| T |
ChildActorOfAsync<T>(string, SupervisorStrategy, CancellationToken)
Spawns an actor as a child of this test actor, and returns the child's ActorRef.
Declaration
public Task<IActorRef> ChildActorOfAsync<T>(string name, SupervisorStrategy supervisorStrategy, CancellationToken cancellationToken = default) where T : ActorBase
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | |
| SupervisorStrategy | supervisorStrategy | |
| CancellationToken | cancellationToken | CancellationToken to cancel the operation |
Returns
| Type | Description |
|---|---|
| Task<IActorRef> |
Type Parameters
| Name | Description |
|---|---|
| T |
ChildActorOfAsync<T>(string, CancellationToken)
Spawns an actor as a child of this test actor, and returns the child's ActorRef.
Declaration
public Task<IActorRef> ChildActorOfAsync<T>(string name, CancellationToken cancellationToken = default) where T : ActorBase
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | |
| CancellationToken | cancellationToken | CancellationToken to cancel the operation |
Returns
| Type | Description |
|---|---|
| Task<IActorRef> |
Type Parameters
| Name | Description |
|---|---|
| T |
ChildActorOfAsync<T>(CancellationToken)
Spawns an actor as a child of this test actor, and returns the child's ActorRef.
Declaration
public Task<IActorRef> ChildActorOfAsync<T>(CancellationToken cancellationToken = default) where T : ActorBase
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | cancellationToken | CancellationToken to cancel the operation |
Returns
| Type | Description |
|---|---|
| Task<IActorRef> |
Type Parameters
| Name | Description |
|---|---|
| T |
ChildActorOf<T>(SupervisorStrategy, CancellationToken)
Spawns an actor as a child of this test actor, and returns the child's ActorRef.
Declaration
public IActorRef ChildActorOf<T>(SupervisorStrategy supervisorStrategy, CancellationToken cancellationToken = default) where T : ActorBase
Parameters
| Type | Name | Description |
|---|---|---|
| SupervisorStrategy | supervisorStrategy | |
| CancellationToken | cancellationToken | CancellationToken to cancel the operation |
Returns
| Type | Description |
|---|---|
| IActorRef |
Type Parameters
| Name | Description |
|---|---|
| T |
ChildActorOf<T>(string, SupervisorStrategy, CancellationToken)
Spawns an actor as a child of this test actor, and returns the child's ActorRef.
Declaration
public IActorRef ChildActorOf<T>(string name, SupervisorStrategy supervisorStrategy, CancellationToken cancellationToken = default) where T : ActorBase
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | |
| SupervisorStrategy | supervisorStrategy | |
| CancellationToken | cancellationToken | CancellationToken to cancel the operation |
Returns
| Type | Description |
|---|---|
| IActorRef |
Type Parameters
| Name | Description |
|---|---|
| T |
ChildActorOf<T>(string, CancellationToken)
Spawns an actor as a child of this test actor, and returns the child's ActorRef.
Declaration
public IActorRef ChildActorOf<T>(string name, CancellationToken cancellationToken = default) where T : ActorBase
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | |
| CancellationToken | cancellationToken | CancellationToken to cancel the operation |
Returns
| Type | Description |
|---|---|
| IActorRef |
Type Parameters
| Name | Description |
|---|---|
| T |
ChildActorOf<T>(CancellationToken)
Spawns an actor as a child of this test actor, and returns the child's ActorRef.
Declaration
public IActorRef ChildActorOf<T>(CancellationToken cancellationToken = default) where T : ActorBase
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | cancellationToken | CancellationToken to cancel the operation |
Returns
| Type | Description |
|---|---|
| IActorRef |
Type Parameters
| Name | Description |
|---|---|
| T |
CompareTo(object)
Declaration
public int CompareTo(object obj)
Parameters
| Type | Name | Description |
|---|---|---|
| object | obj |
Returns
| Type | Description |
|---|---|
| int |
CreateTestProbe(string)
N/A
Declaration
[Obsolete("Cannot create a TestProbe from a TestProbe", true)]
public override TestProbe CreateTestProbe(string name = null)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | N/A |
Returns
| Type | Description |
|---|---|
| TestProbe | N/A |
Overrides
Exceptions
| Type | Condition |
|---|---|
| NotSupportedException | This exception is thrown since a TestProbe cannot be created from a TestProbe. |
Equals(object)
Declaration
public override bool Equals(object obj)
Parameters
| Type | Name | Description |
|---|---|---|
| object | obj |
Returns
| Type | Description |
|---|---|
| bool |
Overrides
| Edit this page View SourceForward(IActorRef)
Forwards the last received message to the specified actor as if the LastMessage was sent directly to the actor in the first place.
Declaration
public void Forward(IActorRef actor)
Parameters
| Type | Name | Description |
|---|---|---|
| IActorRef | actor | The actor to forward to. |
Forward(IActorRef, object)
Forwards a message to the specified actor. As sender the sender of the last message is used.
Declaration
public void Forward(IActorRef actor, object message)
Parameters
| Type | Name | Description |
|---|---|---|
| IActorRef | actor | The actor to forward to. |
| object | message | The message. |
GetHashCode()
Declaration
public override int GetHashCode()
Returns
| Type | Description |
|---|---|
| int |
Overrides
| Edit this page View SourceReply(object)
Send message to the sender of the last received message.
Declaration
public void Reply(object message)
Parameters
| Type | Name | Description |
|---|---|---|
| object | message | The message. |
Send(IActorRef, object)
Send message to an actor while using the probe as the sender. Replies will be available for inspection with all of TestKit's assertion methods.
Declaration
public void Send(IActorRef actor, object message)
Parameters
| Type | Name | Description |
|---|---|---|
| IActorRef | actor | The actor. |
| object | message | The message. |
SendSystemMessage(ISystemMessage)
Sends a system message to the test probe
Declaration
public void SendSystemMessage(ISystemMessage message)
Parameters
| Type | Name | Description |
|---|---|---|
| ISystemMessage | message | The message to send |
SendSystemMessage(ISystemMessage, IActorRef)
Sends a system message to the test probe
Declaration
public void SendSystemMessage(ISystemMessage message, IActorRef sender)
Parameters
| Type | Name | Description |
|---|---|---|
| ISystemMessage | message | The message to send |
| IActorRef | sender | NOT USED. |
ToString()
Declaration
public override string ToString()
Returns
| Type | Description |
|---|---|
| string |
Edit this page