mirror of
https://github.com/dotnet/MQTTnet.git
synced 2026-10-21 12:16:02 +08:00
Fix unit tests
This commit is contained in:
@@ -13,7 +13,7 @@
|
|||||||
<releaseNotes>initial version
|
<releaseNotes>initial version
|
||||||
</releaseNotes>
|
</releaseNotes>
|
||||||
<copyright>Copyright Christian Kratky 2016-2017</copyright>
|
<copyright>Copyright Christian Kratky 2016-2017</copyright>
|
||||||
<tags>MQTT Message Queue Telemetry Transport MQTTClient MQTTServer Server MQTTBroker Broker NETStandard IoT InternetOfThings Messaging Hardware Arduino Sensor Actuator M2M ESP Smart Home Cities Automation</tags>
|
<tags>MQTT Message Queue Telemetry Transport MQTTClient MQTTServer Server MQTTBroker Broker NETStandard IoT InternetOfThings Messaging Hardware Arduino Sensor Actuator M2M ESP Smart Home Cities Automation Xamarin</tags>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<group targetFramework="netstandard2.0">
|
<group targetFramework="netstandard2.0">
|
||||||
<dependency id="MQTTnet" version="2.5" />
|
<dependency id="MQTTnet" version="2.5" />
|
||||||
|
|||||||
@@ -28,7 +28,7 @@
|
|||||||
* [Server] Added support for a custom subscription interceptor which allows denying of subscriptions and closing the connection
|
* [Server] Added support for a custom subscription interceptor which allows denying of subscriptions and closing the connection
|
||||||
</releaseNotes>
|
</releaseNotes>
|
||||||
<copyright>Copyright Christian Kratky 2016-2017</copyright>
|
<copyright>Copyright Christian Kratky 2016-2017</copyright>
|
||||||
<tags>MQTT Message Queue Telemetry Transport MQTTClient MQTTServer Server MQTTBroker Broker NETStandard IoT InternetOfThings Messaging Hardware Arduino Sensor Actuator M2M ESP Smart Home Cities Automation</tags>
|
<tags>MQTT Message Queue Telemetry Transport MQTTClient MQTTServer Server MQTTBroker Broker NETStandard IoT InternetOfThings Messaging Hardware Arduino Sensor Actuator M2M ESP Smart Home Cities Automation Xamarin</tags>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
|
||||||
<group targetFramework="netstandard1.3">
|
<group targetFramework="netstandard1.3">
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
using System.IO;
|
||||||
|
using System.Threading;
|
||||||
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||||
|
using MQTTnet.Core.Serializer;
|
||||||
|
|
||||||
|
namespace MQTTnet.Core.Tests
|
||||||
|
{
|
||||||
|
[TestClass]
|
||||||
|
public class MqttPacketReaderTests
|
||||||
|
{
|
||||||
|
[TestMethod]
|
||||||
|
public void MqttPacketReader_EmptyStream()
|
||||||
|
{
|
||||||
|
var memStream = new MemoryStream();
|
||||||
|
var header = MqttPacketReader.ReadHeaderFromSource(memStream, CancellationToken.None);
|
||||||
|
|
||||||
|
Assert.IsNull(header);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -274,8 +274,8 @@ namespace MQTTnet.Core.Tests
|
|||||||
public async Task MqttServer_PersistRetainedMessage()
|
public async Task MqttServer_PersistRetainedMessage()
|
||||||
{
|
{
|
||||||
var storage = new TestStorage();
|
var storage = new TestStorage();
|
||||||
|
|
||||||
var serverAdapter = new TestMqttServerAdapter();
|
var serverAdapter = new TestMqttServerAdapter();
|
||||||
|
|
||||||
var services = new ServiceCollection()
|
var services = new ServiceCollection()
|
||||||
.AddLogging()
|
.AddLogging()
|
||||||
.AddMqttServer()
|
.AddMqttServer()
|
||||||
@@ -297,7 +297,7 @@ namespace MQTTnet.Core.Tests
|
|||||||
await s.StopAsync();
|
await s.StopAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
s = services.GetRequiredService<IMqttServer>();
|
s = new MqttFactory(services).CreateMqttServer(options => options.Storage = storage);
|
||||||
|
|
||||||
var receivedMessagesCount = 0;
|
var receivedMessagesCount = 0;
|
||||||
try
|
try
|
||||||
|
|||||||
Reference in New Issue
Block a user