public async Task ListLocations_Success() { var payload = "{\r\n \"Method\": \"locations.list\"\r\n}"; _nativeMqttClient.Setup(d => d.PublishMessage(It.IsAny <Request>(), It.IsAny <CancellationToken>())) .ReturnsAsync(new PublishResult(PublishResultCode.Success), TimeSpan.FromSeconds(1)); var response = await _client.GetLocations(); response.IsSuccess.Should().BeTrue(); _nativeMqttClient.Verify(d => d.PublishMessage(It.Is <Request>(d => d.Payload == payload), It.IsAny <CancellationToken>()), Times.Once); }