You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

MqttPacketWriter_Tests.cs 701 B

5 years ago
12345678910111213141516171819202122232425
  1. using Microsoft.VisualStudio.TestTools.UnitTesting;
  2. using MQTTnet.Formatter;
  3. namespace MQTTnet.Tests
  4. {
  5. [TestClass]
  6. public class MqttPacketWriter_Tests
  7. {
  8. [TestMethod]
  9. public void WritePacket()
  10. {
  11. var writer = new MqttPacketWriter();
  12. Assert.AreEqual(0, writer.Length);
  13. writer.WriteWithLengthPrefix("1234567890");
  14. Assert.AreEqual(10 + 2, writer.Length);
  15. writer.WriteWithLengthPrefix(new byte[300]);
  16. Assert.AreEqual(300 + 2 + 12, writer.Length);
  17. writer.WriteWithLengthPrefix(new byte[5000]);
  18. Assert.AreEqual(5000 + 2 + 300 + 2 + 12, writer.Length);
  19. }
  20. }
  21. }