Refactor subscribe and unsubscribe to support MQTTv5.

This commit is contained in:
Christian Kratky
2019-01-21 21:38:39 +01:00
parent 0d6e244f84
commit ebf0e91ab8
39 changed files with 1183 additions and 476 deletions
@@ -1,7 +1,7 @@
using System.IO;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using MQTTnet.Exceptions;
using MQTTnet.Formatter;
using MQTTnet.Internal;
@@ -11,12 +11,13 @@ namespace MQTTnet.Tests
public class MqttPacketReaderTests
{
[TestMethod]
[ExpectedException(typeof(MqttCommunicationClosedGracefullyException))]
public void MqttPacketReader_EmptyStream()
public async Task MqttPacketReader_EmptyStream()
{
var fixedHeader = new byte[2];
var reader = new MqttPacketReader(new TestMqttChannel(new MemoryStream()));
reader.ReadFixedHeaderAsync(fixedHeader, CancellationToken.None).GetAwaiter().GetResult();
var readResult = await reader.ReadFixedHeaderAsync(fixedHeader, CancellationToken.None);
Assert.IsTrue(readResult.ConnectionClosed);
}
}
}