コード例 #1
0
        public void PackStructuredData()
        {
            Iso8583TermApp msg = new Iso8583TermApp();

            msg.MessageType = Iso8583TermApp.MsgType._1200_TRAN_REQ;
            msg[Iso8583TermApp.Bit._011_SYS_TRACE_AUDIT_NUM] = "123456";
            HashtableMessage sd = new HashtableMessage();

            sd.Add("key", "value");
            msg.StructuredData = sd;

            String actual   = Formatters.Binary.GetString(msg.ToMsg());
            String expected = "4231323030002000000001000031323334353630303231F0002100013030313231336B6579313576616C7565";

            Assert.AreEqual(expected, actual);
        }
コード例 #2
0
        public void testPutStructuredDataExistingSd()
        {
            Iso8583TermApp msg     = new Iso8583TermApp();
            AdditionalData addData = new AdditionalData();

            addData[AdditionalData.Field.StructuredData] = "13PSI11V";
            msg.AdditionalData = addData;
            HashtableMessage sd = new HashtableMessage();

            sd.Add("ABC", "1234");
            msg.StructuredData = sd;

            HashtableMessage checkSd = msg.StructuredData;

            Assert.AreNotSame(sd, checkSd);
            Assert.IsTrue(checkSd.ContainsKey("ABC"));
            Assert.IsFalse(checkSd.ContainsKey("PSI"));
        }