use std::{error::Error as StdError, future::Future, time::Duration};
use crate::{Broker, RawMessage};
pub trait TestClient: Send {
type Broker: Broker;
type Error: StdError + Send + Sync + 'static;
fn start() -> impl Future<Output = Result<Self, Self::Error>> + Send
where
Self: Sized;
fn broker(&self) -> &Self::Broker;
fn publish(
&self,
topic: &str,
payload: &[u8],
) -> impl Future<Output = Result<(), Self::Error>> + Send;
fn subscribe(
&self,
topic: &str,
) -> impl Future<Output = Result<<Self::Broker as Broker>::Subscriber, Self::Error>> + Send;
fn publisher(
&self,
) -> impl Future<Output = Result<<Self::Broker as Broker>::Publisher, Self::Error>> + Send;
fn expect_published(
&self,
topic: &str,
count: usize,
timeout: Duration,
) -> impl Future<Output = Result<Vec<RawMessage>, Self::Error>> + Send;
fn shutdown(self) -> impl Future<Output = Result<(), Self::Error>> + Send;
}