mirror of
https://github.com/dotnet/MQTTnet.git
synced 2026-10-15 17:00:03 +08:00
24 lines
629 B
C#
24 lines
629 B
C#
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
|
using MQTTnet.Formatter;
|
|
|
|
namespace MQTTnet.Tests
|
|
{
|
|
[TestClass]
|
|
public class Protocol_Tests
|
|
{
|
|
[TestMethod]
|
|
public void Encode_Four_Byte_Integer()
|
|
{
|
|
for (uint i = 0; i < 268435455; i++)
|
|
{
|
|
var buffer = MqttPacketWriter.EncodeVariableLengthInteger(i);
|
|
var reader = new MqttPacketBodyReader(buffer.Array, buffer.Offset, buffer.Count);
|
|
|
|
var checkValue = reader.ReadVariableLengthInteger();
|
|
|
|
Assert.AreEqual(i, checkValue);
|
|
}
|
|
}
|
|
}
|
|
}
|