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.

39 lines
1.2 KiB

  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. using Xunit;
  5. using JT809.Protocol;
  6. using JT809.Protocol.Extensions;
  7. using JT809.Protocol.MessageBody;
  8. using JT809.Protocol.Exceptions;
  9. using JT809.Protocol.SubMessageBody;
  10. using JT809.Protocol.Enums;
  11. namespace JT809.Protocol.Test.JT809SubMessageBody
  12. {
  13. public class JT809_0x1500_0x1504Test
  14. {
  15. [Fact]
  16. public void Test1()
  17. {
  18. JT809_0x1400_0x1403 jT809_0x1400_0x1403 = new JT809_0x1400_0x1403
  19. {
  20. Result = JT809_0x1403_Result.将来处理,
  21. InfoID = 3344,
  22. };
  23. var hex = JT809Serializer.Serialize(jT809_0x1400_0x1403).ToHexString();
  24. // "00 00 0D 10 03"
  25. Assert.Equal("00000D1003",hex);
  26. }
  27. [Fact]
  28. public void Test2()
  29. {
  30. var bytes = "00 00 0D 10 03".ToHexBytes();
  31. JT809_0x1400_0x1403 jT809_0x1400_0x1403 = JT809Serializer.Deserialize<JT809_0x1400_0x1403>(bytes);
  32. Assert.Equal(JT809_0x1403_Result.将来处理, jT809_0x1400_0x1403.Result);
  33. Assert.Equal((uint)3344, jT809_0x1400_0x1403.InfoID);
  34. }
  35. }
  36. }