您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

MqttPacketReaderTests.cs 658 B

6 年前
1234567891011121314151617181920212223
  1. using System.IO;
  2. using System.Threading;
  3. using System.Threading.Tasks;
  4. using Microsoft.VisualStudio.TestTools.UnitTesting;
  5. using MQTTnet.Formatter;
  6. using MQTTnet.Internal;
  7. namespace MQTTnet.Tests
  8. {
  9. [TestClass]
  10. public class MqttPacketReaderTests
  11. {
  12. [TestMethod]
  13. public async Task MqttPacketReader_EmptyStream()
  14. {
  15. var fixedHeader = new byte[2];
  16. var reader = new MqttPacketReader(new TestMqttChannel(new MemoryStream()));
  17. var readResult = await reader.ReadFixedHeaderAsync(fixedHeader, CancellationToken.None);
  18. Assert.IsTrue(readResult.ConnectionClosed);
  19. }
  20. }
  21. }