瀏覽代碼

Added UnitTests.

release/3.x.x
Christian Kratky 5 年之前
父節點
當前提交
dbb227406b
共有 1 個檔案被更改,包括 19 行新增0 行删除
  1. +19
    -0
      Tests/MQTTnet.Core.Tests/MqttClient_Tests.cs

+ 19
- 0
Tests/MQTTnet.Core.Tests/MqttClient_Tests.cs 查看文件

@@ -158,6 +158,25 @@ namespace MQTTnet.Tests
}
}

[TestMethod]
public async Task Fire_Disconnected_Event_On_Server_Shutdown()
{
using (var testEnvironment = new TestEnvironment())
{
var server = await testEnvironment.StartServerAsync();
var client = await testEnvironment.ConnectClientAsync();

var handlerFired = false;
client.UseDisconnectedHandler(e => handlerFired = true);

await server.StopAsync();

await Task.Delay(4000);

Assert.IsTrue(handlerFired);
}
}

[TestMethod]
public async Task Disconnect_Event_Contains_Exception()
{


Loading…
取消
儲存