COROIO: NNet::NActors::TMockActorContext Class Reference
COROIO
Loading...
Searching...
No Matches
NNet::NActors::TMockActorContext Class Reference

Mock actor context for testing purposes. More...

#include <actor.hpp>

Inheritance diagram for NNet::NActors::TMockActorContext:
NNet::NActors::TActorContext

Public Member Functions

 TMockActorContext (TActorId sender, TActorId self, TActorSystem *actorSystem)
Public Member Functions inherited from NNet::NActors::TActorContext
TActorId Sender () const
 Get the sender of the current message.
TActorId Self () const
 Get this actor's ID.
void Send (TActorId to, TMessageId messageId, TBlob blob)
 Send a message to another actor.
void Forward (TActorId to, TMessageId messageId, TBlob blob)
 Forward a message to another actor (preserves original sender).
template<typename T, typename... Args>
void Send (TActorId to, Args &&... args)
 Send a typed message to another actor (non-blocking).
template<typename T, typename... Args>
void Forward (TActorId to, Args &&... args)
 Forward a typed message to another actor, preserving the original sender.
void SendAs (TActorId from, TActorId to, TMessageId messageId, TBlob blob)
 Send a message with an explicitly specified sender.
template<typename T, typename... Args>
void SendAs (TActorId from, TActorId to, Args &&... args)
 Send a typed message with an explicitly specified sender.
TEvent Schedule (TTime when, TActorId sender, TActorId recipient, TMessageId messageId, TBlob blob)
 Schedule a message to be delivered at a specific time.
template<typename T, typename... Args>
TEvent Schedule (TTime when, TActorId sender, TActorId recipient, Args &&... args)
 Schedule a typed message to be delivered at a specific time.
void Cancel (TEvent event)
 Cancel a previously scheduled message.
TActorId Register (std::unique_ptr< IActor > actor)
 Registers a new actor in the same actor system.
TFuture< void > Sleep (TTime until)
 Suspend the current handler until a specific time.
template<typename Rep, typename Period>
TFuture< void > Sleep (std::chrono::duration< Rep, Period > duration)
 Suspend the current handler for a duration.
template<typename T, typename TQuestion>
TFuture< T > Ask (TActorId recipient, TQuestion &&question)
 Send a request and suspend until a reply of type T arrives.
TAsync StartAsync ()
 Start an asynchronous operation context.

Additional Inherited Members

Public Types inherited from NNet::NActors::TActorContext
using TPtr = std::unique_ptr<TActorContext>
Static Public Member Functions inherited from NNet::NActors::TActorContext
static void * operator new (size_t)=delete
static void * operator new (size_t size, TActorSystem *actorSystem)
static void operator delete (void *ptr)

Detailed Description

Mock actor context for testing purposes.

TMockActorContext provides a testable version of TActorContext that can be constructed directly for unit testing actors.


The documentation for this class was generated from the following file: