Skip to content

Commit

Permalink
Fix unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
chkr1011 committed May 21, 2024
1 parent b8bbedb commit a71fa63
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Source/MQTTnet.Tests/Clients/MqttClient/MqttClient_Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -944,18 +944,20 @@ public void Backward_compatible_TCP_options()
}
};

Assert.AreEqual("host:3", options.ChannelOptions.ToString());
Assert.AreEqual("host", ((MqttClientTcpOptions)options.ChannelOptions).Server);
Assert.AreEqual(3, ((MqttClientTcpOptions)options.ChannelOptions).Port);

options = new MqttClientOptionsBuilder().WithEndPoint(new DnsEndPoint("host", 3)).Build();

Assert.AreEqual("Unspecified/host:3", options.ChannelOptions.ToString());
Assert.AreEqual("host", ((MqttClientTcpOptions)options.ChannelOptions).Server);
Assert.AreEqual(3, ((MqttClientTcpOptions)options.ChannelOptions).Port);

options = new MqttClientOptionsBuilder().WithTcpServer("host").Build();

Assert.AreEqual("host", ((MqttClientTcpOptions)options.ChannelOptions).Server);
Assert.AreEqual(1883, ((MqttClientTcpOptions)options.ChannelOptions).Port);
Assert.AreEqual("Unspecified/host:1883", options.ChannelOptions.ToString());

options = new MqttClientOptionsBuilder().WithTlsOptions(o => o.UseTls()).WithTcpServer("host").Build();

Expand All @@ -971,7 +973,7 @@ public void Backward_compatible_TCP_options()
};

Assert.AreEqual("host", ((MqttClientTcpOptions)options.ChannelOptions).Server);
Assert.AreEqual(1883, ((MqttClientTcpOptions)options.ChannelOptions).Port);
Assert.AreEqual(null, ((MqttClientTcpOptions)options.ChannelOptions).Port);
}
}
}

0 comments on commit a71fa63

Please sign in to comment.