Class TestProbe
TestKit-based probe which allows sending, reception and reply. Use CreateTestProbe(string) inside your test to create new instances.
public class TestProbe : TestKitBase, IActorRefFactory, INoImplicitSender, IInternalActorRef, IActorRef, ICanTell, IEquatable<IActorRef>, IComparable<IActorRef>, ISurrogated, IComparable, IActorRefScope
- Inheritance
-
TestProbe
- Implements
-
IActorRefFactoryIInternalActorRefIActorRefICanTellIEquatable<IActorRef>IComparable<IActorRef>ISurrogatedIActorRefScope
- Inherited Members
Constructors
TestProbe(ActorSystem, ITestKitAssertions, string)
TBD
public TestProbe(ActorSystem system, ITestKitAssertions assertions, string testProbeName = null)
Parameters
system
ActorSystemTBD
assertions
ITestKitAssertionsTBD
testProbeName
stringTBD
Properties
Ref
Gets the reference of this probe.
public IActorRef Ref { get; }
Property Value
- IActorRef
Sender
Gets the sender of the last message
public IActorRef Sender { get; }
Property Value
- IActorRef
Methods
ChildActorOfAsync<T>(SupervisorStrategy, CancellationToken)
Spawns an actor as a child of this test actor, and returns the child's ActorRef.
public Task<IActorRef> ChildActorOfAsync<T>(SupervisorStrategy supervisorStrategy, CancellationToken cancellationToken = default) where T : ActorBase
Parameters
supervisorStrategy
SupervisorStrategycancellationToken
CancellationTokenCancellationToken to cancel the operation
Returns
- Task<IActorRef>
Type Parameters
T
ChildActorOfAsync<T>(string, SupervisorStrategy, CancellationToken)
Spawns an actor as a child of this test actor, and returns the child's ActorRef.
public Task<IActorRef> ChildActorOfAsync<T>(string name, SupervisorStrategy supervisorStrategy, CancellationToken cancellationToken = default) where T : ActorBase
Parameters
name
stringsupervisorStrategy
SupervisorStrategycancellationToken
CancellationTokenCancellationToken to cancel the operation
Returns
- Task<IActorRef>
Type Parameters
T
ChildActorOfAsync<T>(string, CancellationToken)
Spawns an actor as a child of this test actor, and returns the child's ActorRef.
public Task<IActorRef> ChildActorOfAsync<T>(string name, CancellationToken cancellationToken = default) where T : ActorBase
Parameters
name
stringcancellationToken
CancellationTokenCancellationToken to cancel the operation
Returns
- Task<IActorRef>
Type Parameters
T
ChildActorOfAsync<T>(CancellationToken)
Spawns an actor as a child of this test actor, and returns the child's ActorRef.
public Task<IActorRef> ChildActorOfAsync<T>(CancellationToken cancellationToken = default) where T : ActorBase
Parameters
cancellationToken
CancellationTokenCancellationToken to cancel the operation
Returns
- Task<IActorRef>
Type Parameters
T
ChildActorOf<T>(SupervisorStrategy, CancellationToken)
Spawns an actor as a child of this test actor, and returns the child's ActorRef.
public IActorRef ChildActorOf<T>(SupervisorStrategy supervisorStrategy, CancellationToken cancellationToken = default) where T : ActorBase
Parameters
supervisorStrategy
SupervisorStrategycancellationToken
CancellationTokenCancellationToken to cancel the operation
Returns
- IActorRef
Type Parameters
T
ChildActorOf<T>(string, SupervisorStrategy, CancellationToken)
Spawns an actor as a child of this test actor, and returns the child's ActorRef.
public IActorRef ChildActorOf<T>(string name, SupervisorStrategy supervisorStrategy, CancellationToken cancellationToken = default) where T : ActorBase
Parameters
name
stringsupervisorStrategy
SupervisorStrategycancellationToken
CancellationTokenCancellationToken to cancel the operation
Returns
- IActorRef
Type Parameters
T
ChildActorOf<T>(string, CancellationToken)
Spawns an actor as a child of this test actor, and returns the child's ActorRef.
public IActorRef ChildActorOf<T>(string name, CancellationToken cancellationToken = default) where T : ActorBase
Parameters
name
stringcancellationToken
CancellationTokenCancellationToken to cancel the operation
Returns
- IActorRef
Type Parameters
T
ChildActorOf<T>(CancellationToken)
Spawns an actor as a child of this test actor, and returns the child's ActorRef.
public IActorRef ChildActorOf<T>(CancellationToken cancellationToken = default) where T : ActorBase
Parameters
cancellationToken
CancellationTokenCancellationToken to cancel the operation
Returns
- IActorRef
Type Parameters
T
CompareTo(object)
public int CompareTo(object obj)
Parameters
obj
object
Returns
CreateTestProbe(string)
N/A
[Obsolete("Cannot create a TestProbe from a TestProbe", true)]
public override TestProbe CreateTestProbe(string name = null)
Parameters
name
stringN/A
Returns
- TestProbe
N/A
Exceptions
- NotSupportedException
This exception is thrown since a TestProbe cannot be created from a TestProbe.
Equals(object)
public override bool Equals(object obj)
Parameters
obj
object
Returns
Forward(IActorRef)
Forwards the last received message to the specified actor as if the LastMessage was sent directly to the actor in the first place.
public void Forward(IActorRef actor)
Parameters
actor
IActorRefThe actor to forward to.
Forward(IActorRef, object)
Forwards a message to the specified actor. As sender the sender of the last message is used.
public void Forward(IActorRef actor, object message)
Parameters
actor
IActorRefThe actor to forward to.
message
objectThe message.
GetHashCode()
public override int GetHashCode()
Returns
Reply(object)
Send message to the sender of the last received message.
public void Reply(object message)
Parameters
message
objectThe 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.
public void Send(IActorRef actor, object message)
Parameters
actor
IActorRefThe actor.
message
objectThe message.
SendSystemMessage(ISystemMessage)
Sends a system message to the test probe
public void SendSystemMessage(ISystemMessage message)
Parameters
message
ISystemMessageThe message to send
SendSystemMessage(ISystemMessage, IActorRef)
Sends a system message to the test probe
public void SendSystemMessage(ISystemMessage message, IActorRef sender)
Parameters
message
ISystemMessageThe message to send
sender
IActorRefNOT USED.
ToString()
public override string ToString()