create_mock_client

Function create_mock_client 

Source
pub fn create_mock_client<T: ActorEntity>(
    buffer_size: usize,
) -> (ResourceClient<T>, Receiver<ResourceRequest<T>>)
Expand description

Creates a mock client and a receiver for asserting requests.

§Testing Strategy

In unit/integration tests, we don’t want to spin up a full ResourceActor if we are just testing the Client logic (e.g., OrderClient).

Instead, we create a “Mock Client”. This client sends messages to a channel we control (receiver). We can then inspect the messages arriving on that channel and assert they are correct. This allows us to simulate the Actor’s behavior (success, failure, delays) deterministically.

Note: Consider using MockClient for a more fluent API.