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.
 
 
 
 

33 regels
870 B

  1. using Microsoft.VisualStudio.TestTools.UnitTesting;
  2. using MQTTnet.Client;
  3. namespace MQTTnet.Tests
  4. {
  5. [TestClass]
  6. public class MqttPacketIdentifierProvider_Tests
  7. {
  8. [TestMethod]
  9. public void Reset()
  10. {
  11. var p = new MqttPacketIdentifierProvider();
  12. Assert.AreEqual(1, p.GetNextPacketIdentifier());
  13. Assert.AreEqual(2, p.GetNextPacketIdentifier());
  14. p.Reset();
  15. Assert.AreEqual(1, p.GetNextPacketIdentifier());
  16. }
  17. [TestMethod]
  18. public void ReachBoundaries()
  19. {
  20. var p = new MqttPacketIdentifierProvider();
  21. for (ushort i = 0; i < ushort.MaxValue; i++)
  22. {
  23. Assert.AreEqual(i + 1, p.GetNextPacketIdentifier());
  24. }
  25. Assert.AreEqual(1, p.GetNextPacketIdentifier());
  26. }
  27. }
  28. }