123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119 |
- using FuRen_Sinopec_IcCardReader;
- using Microsoft.VisualStudio.TestTools.UnitTesting;
- using Edge.Core.Parser.BinaryParser.Util;
- using System.Linq;
- namespace FuRen_Sinopec_IcCardReader_Test
- {
- [TestClass]
- public class UnitTest1
- {
- [TestMethod]
- public void Deserialize_TestMethod0()
- {
- var raw = "FA 00 E0 68 " +
- "00 17 " +
- "30 " +
- "20 19 12 24 23 02 31 00 01 01 01 01 F4 02 00 00 C0 3D";
- var rawBytes = raw.ToBytes();
- var p = new FuRen_Sinopec_IcCardReader.Parser();
- var incoming = p.Deserialize(rawBytes.ToArray()) as PumpGenericInquiryCommand;
- Assert.AreEqual(true, incoming != null, "Should have type of message: PumpGenericInquiryCommand");
- }
- [TestMethod]
- public void Deserialize_TestMethod3()
- {
- var raw = "FA 00 E0 43 " +
- "00 17 " +
- "30 " +
- "20 19 12 24 23 04 08 00 01 01 01 01 F4 02 00 00 85 D1";
- var rawBytes = raw.ToBytes();
- var p = new FuRen_Sinopec_IcCardReader.Parser();
- var incoming = p.Deserialize(rawBytes.ToArray()) as PumpGenericInquiryCommand;
- Assert.AreEqual(true, incoming != null, "Should have type of message: PumpGenericInquiryCommand");
- }
- [TestMethod]
- public void Deserialize_TestMethod4()
- {
- /* handle 0x31 with none sub message*/
- var raw = " FA E0 00 4E 00 02 31 00 90 3D";
- var rawBytes = raw.ToBytes();
- var p = new FuRen_Sinopec_IcCardReader.Parser();
- var incoming = p.Deserialize(rawBytes.ToArray()) as PumpStateChangeCommand;
- var explain = incoming.ToLogString();
- Assert.AreEqual(true, incoming != null, "Should have type of message: PumpStateChangeRequest");
- }
- [TestMethod]
- public void Deserialize_TestMethod5()
- {
- /* handle 0x31 with only card inserted sub message*/
- var raw = "FA E0 00 50 00 21 " +
- "31 " +
- "01 01" +
- "07 10 01 02 04 00 00 26 24 23 99 27 00 00 00 09" +
- "FD D0 4F 71";
- var rawBytes = raw.ToBytes();
- var p = new FuRen_Sinopec_IcCardReader.Parser();
- var incoming = p.Deserialize(rawBytes.ToArray()) as PumpStateChangeCommand;
- var explain = incoming.ToLogString();
- Assert.AreEqual(true, incoming != null, "Should have type of message: PumpStateChangeRequest");
- }
- [TestMethod]
- public void Deserialize_TestMethod6()
- {
- /* handle 0x31 with only nozzle operating sub message*/
- var raw = "FA E0 00 43 00 13 " +
- "31 " +
- "01 02 07 00 00 07 CD 00 01 21 02 B3 0A 27";
- var rawBytes = raw.ToBytes();
- var p = new FuRen_Sinopec_IcCardReader.Parser();
- var incoming = p.Deserialize(rawBytes.ToArray()) as PumpStateChangeCommand;
- var explain = incoming.ToLogString();
- Assert.AreEqual(true, incoming != null, "Should have type of message: PumpStateChangeRequest");
- }
- [TestMethod]
- public void Deserialize_TestMethod8()
- {
- var raw = "FA E0 00 44 00 96 " +
- "32 " +
- "00 00 58 AF 10 20 19" +
- "12 24 23 03 34 01 02 04 00 00 26 24 23 99 27" +
- "00 09 F6 03 00 07 CD 00 00 00 00 00 00 00 00" +
- "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00" +
- "00 00 00 00 00 00 00 00 00 00 00 00 00 00 07" +
- "10 52 00 01 21 02 B3 00 01 48 E5 E3 00 00 00" +
- "00 00 00 00 00 00 00 00 00 00 00 00 58 01";
- var rawBytes = raw.ToBytes();
- var p = new FuRen_Sinopec_IcCardReader.Parser();
- var incoming = p.Deserialize(rawBytes.ToArray()) as PumpNotifyTransactionDoneCommand;
- var explain = incoming.ToLogString();
- Assert.AreEqual(true, incoming != null, "Should have type of message: PumpNotifyTransactionDoneRequest");
- }
- [TestMethod]
- public void Deserialize_TestMethod11()
- {
- var raw = "FA E0 00 44 " +
- "00 96 " +
- "32 00 00 58 AF 10 20 19 12 24 23 03 34 01 02 04 00 00 26 24 23 99 27 00 09 F6 03 00 07 CD 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 07 10 52 00 01 21 02 B3 00 01 48 E5 E3 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 58 01";
- var rawBytes = raw.ToBytes();
- var p = new FuRen_Sinopec_IcCardReader.Parser();
- var incoming = p.Deserialize(rawBytes.ToArray()) as PumpNotifyTransactionDoneCommand;
- var explain = incoming.ToLogString();
- Assert.AreEqual(true, incoming != null, "Should have type of message: PumpNotifyTransactionDoneRequest");
- }
- }
- }
|