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.

44 regels
1.7 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_0x9300_0x9302Test
  14. {
  15. private JT809Serializer JT809Serializer = new JT809Serializer();
  16. [Fact]
  17. public void Test1()
  18. {
  19. JT809_0x9300_0x9302 jT809_0X9300_0X9302 = new JT809_0x9300_0x9302
  20. {
  21. ObjectType= JT809_0x9302_ObjectType.下级平台所属单一平台,
  22. ObjectID="afdasf3",
  23. InfoID=1234,
  24. InfoContent= "下级平台所属单一平台"
  25. };
  26. var hex = JT809Serializer.Serialize(jT809_0X9300_0X9302).ToHexString();
  27. Assert.Equal("00616664617366330000000000000004D200000014CFC2BCB6C6BDCCA8CBF9CAF4B5A5D2BBC6BDCCA8", hex);
  28. }
  29. [Fact]
  30. public void Test2()
  31. {
  32. var bytes = "00616664617366330000000000000004D200000014CFC2BCB6C6BDCCA8CBF9CAF4B5A5D2BBC6BDCCA8".ToHexBytes();
  33. JT809_0x9300_0x9302 jT809_0X9300_0X9302 = JT809Serializer.Deserialize<JT809_0x9300_0x9302>(bytes);
  34. Assert.Equal(JT809_0x9302_ObjectType.下级平台所属单一平台, jT809_0X9300_0X9302.ObjectType);
  35. Assert.Equal("afdasf3", jT809_0X9300_0X9302.ObjectID);
  36. Assert.Equal((uint)1234, jT809_0X9300_0X9302.InfoID);
  37. Assert.Equal("下级平台所属单一平台", jT809_0X9300_0X9302.InfoContent);
  38. Assert.Equal((uint)20, jT809_0X9300_0X9302.InfoLength);
  39. }
  40. }
  41. }