SocketMgrTest.cs 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. using Edge.Core.Parser.BinaryParser.Util;
  2. using Microsoft.VisualStudio.TestTools.UnitTesting;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Linq;
  6. using System.Text;
  7. using Wayne.FDCPOSInterface;
  8. namespace FdcServerTest
  9. {
  10. [TestClass]
  11. public class SocketMgrTest
  12. {
  13. public static bool ValueEquals(IEnumerable<byte> array1, IEnumerable<byte> array2)
  14. {
  15. if (array1 == null && array2 == null)
  16. {
  17. return true;
  18. }
  19. if ((array1 == null) || (array2 == null))
  20. {
  21. return false;
  22. }
  23. if (array1.Count() != array2.Count())
  24. {
  25. return false;
  26. }
  27. if (array1.Equals(array2))
  28. {
  29. return true;
  30. }
  31. else
  32. {
  33. for (int Index = 0; Index < array1.Count(); Index++)
  34. {
  35. if (!Equals(array1.ElementAt(Index), array2.ElementAt(Index)))
  36. {
  37. return false;
  38. }
  39. }
  40. }
  41. return true;
  42. }
  43. [TestMethod]
  44. public void getMsgLength_Test0()
  45. {
  46. var data = "00 00 01 9f 00 01 4b a9 b2 57 45 a0 dc 84 9b 8b 06 56 79 38 b5 66 3c 3f 78 6d 6c 20 76 65 72 73 69 6f 6e 3d 22 31 2e 30 22 3f 3e 0a 3c 53 65 72 76 69 63 65 52 65 71 75 65 73 74 20 52 65 71 75 65 73 74 54 79 70 65 3d 22 4c 6f 67 4f 6e 22 20 41 70 70 6c 69 63 61 74 69 6f 6e 53 65 6e 64 65 72 3d 22 31 30 31 22 20 57 6f 72 6b 73 74 61 74 69 6f 6e 49 44 3d 22 31 30 31 22 20 52 65 71 75 65 73 74 49 44 3d 22 36 38 36 36 39 35 22 3e 0a 20 20 3c 50 4f 53 64 61 74 61 3e 0a 20 20 20 20 3c 50 4f 53 54 69 6d 65 53 74 61 6d 70 3e 32 30 32 30 2d 30 37 2d 32 39 54 31 37 3a 32 37 3a 30 35 3c 2f 50 4f 53 54 69 6d 65 53 74 61 6d 70 3e 0a 20 20 20 20 3c 52 65 73 70 6f 6e 73 65 50 6f 72 74 3e 34 37 31 31 3c 2f 52 65 73 70 6f 6e 73 65 50 6f 72 74 3e 0a 20 20 20 20 3c 55 6e 73 6f 6c 69 63 69 74 65 64 50 6f 72 74 3e 34 37 31 31 3c 2f 55 6e 73 6f 6c 69 63 69 74 65 64 50 6f 72 74 3e 0a 20 20 20 20 3c 69 6e 74 65 72 66 61 63 65 56 65 72 73 69 6f 6e 3e 30 30 2e 30 37 3c 2f 69 6e 74 65 72 66 61 63 65 56 65 72 73 69 6f 6e 3e 0a 20 20 20 20 3c 70 6f 73 56 61 6c 69 64 61 74 69 6f 6e 3e 63 35 38 32 34 39 62 35 62 65 35 30 39 61 64 35 30 62 31 38 37 32 65 62 35 63 34 31 34 32 33 33 3c 2f 70 6f 73 56 61 6c 69 64 61 74 69 6f 6e 3e 0a 20 20 3c 2f 50 4f 53 64 61 74 61 3e 0a 3c 2f 53 65 72 76 69 63 65 52 65 71 75 65 73 74 3e 0a".ToBytes();
  47. var lengthData = FdcClientTcpHandler.getMsgLength(data);
  48. }
  49. }
  50. }