Class 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 Akka.Actor.IActorRef or you can get the actual Akka.Actor.IActorRef from the Ref property.
public class TestActorRef<TActor> : TestActorRefBase<TActor>, ICanTell, IEquatable<IActorRef>, IInternalActorRef, IActorRef, IComparable<IActorRef>, ISurrogated, IComparable, IActorRefScope where TActor : ActorBase
Type Parameters
TActor
The type of actor
- Inheritance
-
TestActorRefBase<TActor>TestActorRef<TActor>
- Implements
-
ICanTellIEquatable<IActorRef>IInternalActorRefIActorRefIComparable<IActorRef>ISurrogatedIActorRefScope
- Inherited Members
Constructors
TestActorRef(ActorSystem, Props, IActorRef, string)
Initializes a new instance of the TestActorRef<TActor> class.
public TestActorRef(ActorSystem system, Props actorProps, IActorRef supervisor = null, string name = null)
Parameters
system
ActorSystemThe system.
actorProps
PropsThe actor props.
supervisor
IActorRefOptional: The supervisor.
name
stringOptional: The name.
Operators
operator ==(IActorRef, TestActorRef<TActor>)
Compares a specified Akka.Actor.IActorRef to an TestActorRef<TActor> for equality.
public static bool operator ==(IActorRef actorRef, TestActorRef<TActor> testActorRef)
Parameters
actorRef
IActorRefThe actor used for comparison
testActorRef
TestActorRef<TActor>The test actor used for comparison
Returns
- bool
true
if both actors are equal; otherwisefalse
operator ==(TestActorRef<TActor>, IActorRef)
Compares a specified TestActorRef<TActor> to an Akka.Actor.IActorRef for equality.
public static bool operator ==(TestActorRef<TActor> testActorRef, IActorRef actorRef)
Parameters
testActorRef
TestActorRef<TActor>The test actor used for comparison
actorRef
IActorRefThe actor used for comparison
Returns
- bool
true
if both actors are equal; otherwisefalse
operator !=(IActorRef, TestActorRef<TActor>)
Compares a specified Akka.Actor.IActorRef to an TestActorRef<TActor> for inequality.
public static bool operator !=(IActorRef actorRef, TestActorRef<TActor> testActorRef)
Parameters
actorRef
IActorRefThe actor used for comparison
testActorRef
TestActorRef<TActor>The test actor used for comparison
Returns
- bool
true
if both actors are not equal; otherwisefalse
operator !=(TestActorRef<TActor>, IActorRef)
Compares a specified TestActorRef<TActor> to an Akka.Actor.IActorRef for inequality.
public static bool operator !=(TestActorRef<TActor> testActorRef, IActorRef actorRef)
Parameters
testActorRef
TestActorRef<TActor>The test actor used for comparison
actorRef
IActorRefThe actor used for comparison
Returns
- bool
true
if both actors are not equal; otherwisefalse