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.

34 line
1.0 KiB

  1. using JTNE.Protocol.MessageBody;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Text;
  5. using Xunit;
  6. using JTNE.Protocol.Extensions;
  7. namespace JTNE.Protocol.Test.MessageBody
  8. {
  9. public class JTNE_0x80Test
  10. {
  11. [Fact]
  12. public void Test1()
  13. {
  14. JTNE_0x80 jTNE_0X80 = new JTNE_0x80();
  15. jTNE_0X80.QueryTime = DateTime.Parse("2019-01-22 23:55:56");
  16. jTNE_0X80.ParamNum = 2;
  17. jTNE_0X80.ParamList = new byte[] {0x01,0x02 };
  18. var hex = JTNESerializer.Serialize(jTNE_0X80).ToHexString();
  19. Assert.Equal("130116173738020102", hex);
  20. }
  21. [Fact]
  22. public void Test2()
  23. {
  24. var data = "130116173738020102".ToHexBytes();
  25. JTNE_0x80 jTNE_0X80 = JTNESerializer.Deserialize<JTNE_0x80>(data);
  26. Assert.Equal(DateTime.Parse("2019-01-22 23:55:56"), jTNE_0X80.QueryTime);
  27. Assert.Equal(2, jTNE_0X80.ParamNum);
  28. Assert.Equal(new byte[] { 0x01, 0x02 }, jTNE_0X80.ParamList);
  29. }
  30. }
  31. }