Show / Hide Table of Contents

    Interface IMqttTestingHelper

    Exposes some helper methods and shortcuts to simplify testing.

    Inherited Members
    ITestingHelper.GetConsumer(string)
    ITestingHelper.GetConsumerForEndpoint(string)
    ITestingHelper.GetProducerForEndpoint(string)
    ITestingHelper.WaitUntilConnectedAsync(TimeSpan?)
    ITestingHelper.WaitUntilConnectedAsync(bool, TimeSpan?)
    ITestingHelper.WaitUntilConnectedAsync(CancellationToken)
    ITestingHelper.WaitUntilConnectedAsync(bool, CancellationToken)
    ITestingHelper.WaitUntilAllMessagesAreConsumedAsync(params string[])
    ITestingHelper.WaitUntilAllMessagesAreConsumedAsync(TimeSpan?, params string[])
    ITestingHelper.WaitUntilAllMessagesAreConsumedAsync(bool, params string[])
    ITestingHelper.WaitUntilAllMessagesAreConsumedAsync(bool, TimeSpan?)
    ITestingHelper.WaitUntilAllMessagesAreConsumedAsync(bool, TimeSpan?, params string[])
    ITestingHelper.WaitUntilAllMessagesAreConsumedAsync(CancellationToken, params string[])
    ITestingHelper.WaitUntilAllMessagesAreConsumedAsync(bool, CancellationToken, params string[])
    ITestingHelper.WaitUntilOutboxIsEmptyAsync(TimeSpan?)
    ITestingHelper.WaitUntilOutboxIsEmptyAsync(CancellationToken)
    ITestingHelper.IsOutboxEmptyAsync()
    ITestingHelper.Spy
    Namespace: Silverback.Testing
    Assembly: Silverback.Integration.MQTT.Testing.dll
    Syntax
    public interface IMqttTestingHelper : ITestingHelper

    Methods

    GetClientSession(string)

    Gets the IClientSession of the specified client.

    Declaration
    IClientSession GetClientSession(string clientId)
    Parameters
    Type Name Description
    string clientId

    The client id.

    Returns
    Type Description
    IClientSession

    The IClientSession.

    Remarks

    This method works with the mocked MQTT broker only. See UseMockedMqtt(SilverbackBuilder, Action<IMockedMqttOptionsBuilder>?) or AddMockedMqtt(BrokerOptionsBuilder, Action<IMockedMqttOptionsBuilder>?).

    GetMessages(string)

    Gets the messages that have been published to the specified topic.

    Declaration
    IReadOnlyList<MqttApplicationMessage> GetMessages(string topic)
    Parameters
    Type Name Description
    string topic

    The topic.

    Returns
    Type Description
    IReadOnlyList<MqttApplicationMessage>

    The messages published to the topic.

    Remarks

    This method works with the mocked MQTT broker only. See UseMockedMqtt(SilverbackBuilder, Action<IMockedMqttOptionsBuilder>?) or AddMockedMqtt(BrokerOptionsBuilder, Action<IMockedMqttOptionsBuilder>?).

    GetProducer(Action<MqttClientConfigurationBuilder>)

    Gets a new producer with the specified configuration.

    Declaration
    IProducer GetProducer(Action<MqttClientConfigurationBuilder> configurationBuilderAction)
    Parameters
    Type Name Description
    Action<MqttClientConfigurationBuilder> configurationBuilderAction

    An Action<T> that takes the MqttClientConfigurationBuilder and configures it.

    Returns
    Type Description
    IProducer

    The IProducer.

    GitHub E-Mail
    ↑ Back to top © 2026 Sergio Aquilini