mirror of
https://github.com/dotnet/MQTTnet.git
synced 2026-10-20 11:45:43 +08:00
Add UnitTests.
This commit is contained in:
@@ -22,6 +22,27 @@ namespace MQTTnet.Tests
|
|||||||
[TestClass]
|
[TestClass]
|
||||||
public class Server_Tests
|
public class Server_Tests
|
||||||
{
|
{
|
||||||
|
[TestMethod]
|
||||||
|
public async Task Use_Empty_Client_ID()
|
||||||
|
{
|
||||||
|
using (var testEnvironment = new TestEnvironment())
|
||||||
|
{
|
||||||
|
await testEnvironment.StartServerAsync();
|
||||||
|
|
||||||
|
var client = testEnvironment.CreateClient();
|
||||||
|
|
||||||
|
var clientOptions = new MqttClientOptionsBuilder()
|
||||||
|
.WithTcpServer("localhost", testEnvironment.ServerPort)
|
||||||
|
.WithClientId(string.Empty)
|
||||||
|
.Build();
|
||||||
|
|
||||||
|
var connectResult = await client.ConnectAsync(clientOptions);
|
||||||
|
|
||||||
|
Assert.IsFalse(connectResult.IsSessionPresent);
|
||||||
|
Assert.IsTrue(client.IsConnected);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public async Task Publish_At_Most_Once_0x00()
|
public async Task Publish_At_Most_Once_0x00()
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user