Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

MqttPacketIdentifierProvider_Tests.cs 1.0 KiB

pirms 2 gadiem
pirms 6 gadiem
pirms 5 gadiem
123456789101112131415161718192021222324252627282930313233343536
  1. // Licensed to the .NET Foundation under one or more agreements.
  2. // The .NET Foundation licenses this file to you under the MIT license.
  3. // See the LICENSE file in the project root for more information.
  4. using Microsoft.VisualStudio.TestTools.UnitTesting;
  5. using MQTTnet.Client;
  6. namespace MQTTnet.Tests
  7. {
  8. [TestClass]
  9. public class MqttPacketIdentifierProvider_Tests
  10. {
  11. [TestMethod]
  12. public void Reset()
  13. {
  14. var p = new MqttPacketIdentifierProvider();
  15. Assert.AreEqual(1, p.GetNextPacketIdentifier());
  16. Assert.AreEqual(2, p.GetNextPacketIdentifier());
  17. p.Reset();
  18. Assert.AreEqual(1, p.GetNextPacketIdentifier());
  19. }
  20. [TestMethod]
  21. public void ReachBoundaries()
  22. {
  23. var p = new MqttPacketIdentifierProvider();
  24. for (ushort i = 0; i < ushort.MaxValue; i++)
  25. {
  26. Assert.AreEqual(i + 1, p.GetNextPacketIdentifier());
  27. }
  28. Assert.AreEqual(1, p.GetNextPacketIdentifier());
  29. }
  30. }
  31. }