Fix unit tests

This commit is contained in:
Christian Kratky
2017-10-31 14:38:24 +01:00
parent c5e3bc70b1
commit 3a6df2eab0
4 changed files with 24 additions and 4 deletions
+1 -1
View File
@@ -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" />
+1 -1
View File
@@ -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);
}
}
}
+2 -2
View File
@@ -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