瀏覽代碼

Fix UnitTests

release/3.x.x
Christian 6 年之前
父節點
當前提交
54a0265ef9
共有 2 個文件被更改,包括 12 次插入2 次删除
  1. +1
    -1
      Tests/MQTTnet.Core.Tests/MqttServerTests.cs
  2. +11
    -1
      Tests/MQTTnet.Core.Tests/TestMqttCommunicationAdapter.cs

+ 1
- 1
Tests/MQTTnet.Core.Tests/MqttServerTests.cs 查看文件

@@ -156,7 +156,7 @@ namespace MQTTnet.Core.Tests
var message = new MqttApplicationMessageBuilder().WithTopic("a").WithAtLeastOnceQoS().Build();
await c1.SubscribeAsync(new TopicFilter("a", MqttQualityOfServiceLevel.AtLeastOnce));

s.PublishAsync(message).Wait();
await s.PublishAsync(message);
await Task.Delay(500);
}
finally


+ 11
- 1
Tests/MQTTnet.Core.Tests/TestMqttCommunicationAdapter.cs 查看文件

@@ -47,7 +47,17 @@ namespace MQTTnet.Core.Tests
{
ThrowIfPartnerIsNull();

return Task.Run(() => _incomingPackets.Take(), cancellationToken);
return Task.Run(() =>
{
try
{
return _incomingPackets.Take(cancellationToken);
}
catch
{
return null;
}
}, cancellationToken);
}

private void EnqueuePacketInternal(MqttBasePacket packet)


Loading…
取消
儲存