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.

38 lines
1.4 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_0x05Test
  10. {
  11. [Fact]
  12. public void Test1()
  13. {
  14. JTNE_0x05 jTNE_0X05 = new JTNE_0x05();
  15. jTNE_0X05.LoginTime = DateTime.Parse("2019-01-22 23:55:56");
  16. jTNE_0X05.LoginNum = 6666;
  17. jTNE_0X05.PlatformUserName = "SmallChi518";
  18. jTNE_0X05.PlatformPassword = "1234567890123456789";
  19. jTNE_0X05.EncryptMethod = 0x00;
  20. var hex = JTNESerializer.Serialize(jTNE_0X05).ToHexString();
  21. Assert.Equal("1901222355561A0A536D616C6C43686935313800313233343536373839303132333435363738390000", hex);
  22. }
  23. [Fact]
  24. public void Test2()
  25. {
  26. var data = "1901222355561A0A536D616C6C43686935313800313233343536373839303132333435363738390000".ToHexBytes();
  27. JTNE_0x05 jTNE_0X05 = JTNESerializer.Deserialize<JTNE_0x05>(data);
  28. Assert.Equal(DateTime.Parse("2019-01-22 23:55:56"), jTNE_0X05.LoginTime);
  29. Assert.Equal(6666, jTNE_0X05.LoginNum);
  30. Assert.Equal("SmallChi518", jTNE_0X05.PlatformUserName);
  31. Assert.Equal("1234567890123456789", jTNE_0X05.PlatformPassword);
  32. Assert.Equal(0x00, jTNE_0X05.EncryptMethod);
  33. }
  34. }
  35. }