mirror of
https://github.com/dotnet/MQTTnet.git
synced 2026-10-16 09:13:02 +08:00
Fix unit tests
This commit is contained in:
@@ -13,7 +13,7 @@
|
||||
<releaseNotes>initial version
|
||||
</releaseNotes>
|
||||
<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>
|
||||
<group targetFramework="netstandard2.0">
|
||||
<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
|
||||
</releaseNotes>
|
||||
<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>
|
||||
|
||||
<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()
|
||||
{
|
||||
var storage = new TestStorage();
|
||||
|
||||
var serverAdapter = new TestMqttServerAdapter();
|
||||
|
||||
var services = new ServiceCollection()
|
||||
.AddLogging()
|
||||
.AddMqttServer()
|
||||
@@ -297,7 +297,7 @@ namespace MQTTnet.Core.Tests
|
||||
await s.StopAsync();
|
||||
}
|
||||
|
||||
s = services.GetRequiredService<IMqttServer>();
|
||||
s = new MqttFactory(services).CreateMqttServer(options => options.Storage = storage);
|
||||
|
||||
var receivedMessagesCount = 0;
|
||||
try
|
||||
|
||||
Reference in New Issue
Block a user