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.
 
 
 
 

26 lines
690 B

  1. using Microsoft.VisualStudio.TestTools.UnitTesting;
  2. using MQTTnet.Formatter;
  3. namespace MQTTnet.Tests
  4. {
  5. [TestClass]
  6. public class Protocol_Tests
  7. {
  8. [TestMethod]
  9. public void Encode_Four_Byte_Integer()
  10. {
  11. for (uint i = 0; i < 268435455; i++)
  12. {
  13. var writer = new MqttPacketWriter();
  14. writer.WriteVariableLengthInteger(i);
  15. var buffer = writer.GetBuffer();
  16. var reader = new MqttPacketBodyReader(buffer, 0, writer.Length);
  17. var checkValue = reader.ReadVariableLengthInteger();
  18. Assert.AreEqual(i, checkValue);
  19. }
  20. }
  21. }
  22. }