mirror of
https://github.com/dotnet/MQTTnet.git
synced 2026-10-18 18:43:10 +08:00
Add UnitTests.
This commit is contained in:
@@ -54,6 +54,20 @@ namespace MQTTnet.Tests
|
|||||||
1);
|
1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[TestMethod]
|
||||||
|
public async Task Use_Clean_Session()
|
||||||
|
{
|
||||||
|
using (var testEnvironment = new TestEnvironment())
|
||||||
|
{
|
||||||
|
await testEnvironment.StartServerAsync();
|
||||||
|
|
||||||
|
var client = testEnvironment.CreateClient();
|
||||||
|
var connectResult = await client.ConnectAsync(new MqttClientOptionsBuilder().WithTcpServer("localhost", testEnvironment.ServerPort).WithCleanSession().Build());
|
||||||
|
|
||||||
|
Assert.IsFalse(connectResult.IsSessionPresent);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public async Task Will_Message_Do_Not_Send()
|
public async Task Will_Message_Do_Not_Send()
|
||||||
{
|
{
|
||||||
@@ -61,7 +75,7 @@ namespace MQTTnet.Tests
|
|||||||
{
|
{
|
||||||
var receivedMessagesCount = 0;
|
var receivedMessagesCount = 0;
|
||||||
|
|
||||||
await testEnvironment.StartServerAsync(new MqttServerOptionsBuilder());
|
await testEnvironment.StartServerAsync();
|
||||||
|
|
||||||
var willMessage = new MqttApplicationMessageBuilder().WithTopic("My/last/will").WithAtMostOnceQoS().Build();
|
var willMessage = new MqttApplicationMessageBuilder().WithTopic("My/last/will").WithAtMostOnceQoS().Build();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user