Interface IMqttTestingHelper
Exposes some helper methods and shortcuts to simplify testing.
Inherited Members
Namespace: Silverback.Testing
Assembly: Silverback.Integration.MQTT.Testing.dll
Syntax
public interface IMqttTestingHelper : ITestingHelper<MqttBroker>
Methods
| Improve this doc View sourceGetClientSession(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(ISilverbackBuilder, Action<IMockedMqttOptionsBuilder>?) or AddMockedMqtt(IBrokerOptionsBuilder, 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 name of 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(ISilverbackBuilder, Action<IMockedMqttOptionsBuilder>?) or AddMockedMqtt(IBrokerOptionsBuilder, Action<IMockedMqttOptionsBuilder>?).