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.
 
 
 
 

24 lines
629 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 buffer = MqttPacketWriter.EncodeVariableLengthInteger(i);
  14. var reader = new MqttPacketBodyReader(buffer.Array, buffer.Offset, buffer.Count);
  15. var checkValue = reader.ReadVariableLengthInteger();
  16. Assert.AreEqual(i, checkValue);
  17. }
  18. }
  19. }
  20. }