Class MockedMqttClient
A mocked implementation of MQTTnet.Client.IMqttClient from MQTTnet that connects with an in-memory
broker.
Inheritance
MockedMqttClient
Assembly: Silverback.Integration.MQTT.Testing.dll
Syntax
public sealed class MockedMqttClient : IMqttClient, IDisposable
Constructors
|
Improve this doc
View source
MockedMqttClient(IInMemoryMqttBroker, IMockedMqttOptions)
Declaration
public MockedMqttClient(IInMemoryMqttBroker broker, IMockedMqttOptions mockOptions)
Parameters
Properties
|
Improve this doc
View source
IsConnected
A mocked implementation of MQTTnet.Client.IMqttClient from MQTTnet that connects with an in-memory
broker.
Declaration
public bool IsConnected { get; }
Property Value
|
Improve this doc
View source
IsConsumerConnected
Gets a value indicating whether the client is connected and a message handler is bound to it.
Declaration
public bool IsConsumerConnected { get; }
Property Value
|
Improve this doc
View source
Options
A mocked implementation of MQTTnet.Client.IMqttClient from MQTTnet that connects with an in-memory
broker.
Declaration
public MqttClientOptions? Options { get; }
Property Value
Type |
Description |
MqttClientOptions |
|
Methods
|
Improve this doc
View source
ConnectAsync(MqttClientOptions, CancellationToken)
A mocked implementation of MQTTnet.Client.IMqttClient from MQTTnet that connects with an in-memory
broker.
Declaration
public Task<MqttClientConnectResult> ConnectAsync(MqttClientOptions options, CancellationToken cancellationToken = default)
Parameters
Returns
Type |
Description |
Task<MqttClientConnectResult> |
|
|
Improve this doc
View source
DisconnectAsync(MqttClientDisconnectOptions, CancellationToken)
A mocked implementation of MQTTnet.Client.IMqttClient from MQTTnet that connects with an in-memory
broker.
Declaration
public Task DisconnectAsync(MqttClientDisconnectOptions options, CancellationToken cancellationToken = default)
Parameters
Type |
Name |
Description |
MqttClientDisconnectOptions |
options |
|
CancellationToken |
cancellationToken |
|
Returns
|
Improve this doc
View source
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Declaration
|
Improve this doc
View source
PingAsync(CancellationToken)
A mocked implementation of MQTTnet.Client.IMqttClient from MQTTnet that connects with an in-memory
broker.
Declaration
public Task PingAsync(CancellationToken cancellationToken = default)
Parameters
Returns
|
Improve this doc
View source
PublishAsync(MqttApplicationMessage, CancellationToken)
A mocked implementation of MQTTnet.Client.IMqttClient from MQTTnet that connects with an in-memory
broker.
Declaration
public Task<MqttClientPublishResult> PublishAsync(MqttApplicationMessage applicationMessage, CancellationToken cancellationToken = default)
Parameters
Type |
Name |
Description |
MqttApplicationMessage |
applicationMessage |
|
CancellationToken |
cancellationToken |
|
Returns
Type |
Description |
Task<MqttClientPublishResult> |
|
|
Improve this doc
View source
SendExtendedAuthenticationExchangeDataAsync(MqttExtendedAuthenticationExchangeData, CancellationToken)
A mocked implementation of MQTTnet.Client.IMqttClient from MQTTnet that connects with an in-memory
broker.
Declaration
public Task SendExtendedAuthenticationExchangeDataAsync(MqttExtendedAuthenticationExchangeData data, CancellationToken cancellationToken = default)
Parameters
Type |
Name |
Description |
MqttExtendedAuthenticationExchangeData |
data |
|
CancellationToken |
cancellationToken |
|
Returns
|
Improve this doc
View source
SubscribeAsync(MqttClientSubscribeOptions, CancellationToken)
A mocked implementation of MQTTnet.Client.IMqttClient from MQTTnet that connects with an in-memory
broker.
Declaration
public Task<MqttClientSubscribeResult> SubscribeAsync(MqttClientSubscribeOptions options, CancellationToken cancellationToken = default)
Parameters
Type |
Name |
Description |
MqttClientSubscribeOptions |
options |
|
CancellationToken |
cancellationToken |
|
Returns
Type |
Description |
Task<MqttClientSubscribeResult> |
|
|
Improve this doc
View source
UnsubscribeAsync(MqttClientUnsubscribeOptions, CancellationToken)
A mocked implementation of MQTTnet.Client.IMqttClient from MQTTnet that connects with an in-memory
broker.
Declaration
public Task<MqttClientUnsubscribeResult> UnsubscribeAsync(MqttClientUnsubscribeOptions options, CancellationToken cancellationToken = default)
Parameters
Type |
Name |
Description |
MqttClientUnsubscribeOptions |
options |
|
CancellationToken |
cancellationToken |
|
Returns
Type |
Description |
Task<MqttClientUnsubscribeResult> |
|
Events
|
Improve this doc
View source
ApplicationMessageReceivedAsync
A mocked implementation of MQTTnet.Client.IMqttClient from MQTTnet that connects with an in-memory
broker.
Declaration
public event Func<MqttApplicationMessageReceivedEventArgs, Task>? ApplicationMessageReceivedAsync
Event Type
Type |
Description |
Func<MqttApplicationMessageReceivedEventArgs, Task> |
|
|
Improve this doc
View source
ConnectedAsync
A mocked implementation of MQTTnet.Client.IMqttClient from MQTTnet that connects with an in-memory
broker.
Declaration
public event Func<MqttClientConnectedEventArgs, Task>? ConnectedAsync
Event Type
Type |
Description |
Func<MqttClientConnectedEventArgs, Task> |
|
|
Improve this doc
View source
ConnectingAsync
A mocked implementation of MQTTnet.Client.IMqttClient from MQTTnet that connects with an in-memory
broker.
Declaration
public event Func<MqttClientConnectingEventArgs, Task>? ConnectingAsync
Event Type
Type |
Description |
Func<MqttClientConnectingEventArgs, Task> |
|
|
Improve this doc
View source
DisconnectedAsync
A mocked implementation of MQTTnet.Client.IMqttClient from MQTTnet that connects with an in-memory
broker.
Declaration
public event Func<MqttClientDisconnectedEventArgs, Task>? DisconnectedAsync
Event Type
Type |
Description |
Func<MqttClientDisconnectedEventArgs, Task> |
|
|
Improve this doc
View source
InspectPacketAsync
A mocked implementation of MQTTnet.Client.IMqttClient from MQTTnet that connects with an in-memory
broker.
Declaration
public event Func<InspectMqttPacketEventArgs, Task>? InspectPacketAsync
Event Type
Type |
Description |
Func<InspectMqttPacketEventArgs, Task> |
|
Implements
MQTTnet.Client.IMqttClient