コード例 #1
0
        public void TestToMessageString()
        {
            var hash = new HashtableMessage();

            hash["Unit1"]      = "This is the data for unit 1";
            hash["TagNumber2"] = "tag 2";
            const string Expected = "15Unit1227This is the data for unit 1210TagNumber215tag 2";

            Assert.AreEqual(Expected, hash.ToMessageString());
        }
コード例 #2
0
        public void testPutStructuredDataEmtpy()
        {
            Iso8583TermApp   msg = new Iso8583TermApp();
            HashtableMessage sd  = new HashtableMessage();

            sd["PSI"]          = "V";
            msg.StructuredData = sd;
            AdditionalData addData = msg.AdditionalData;

            Assert.AreEqual("13PSI11V", addData[AdditionalData.Field.StructuredData]);
        }
コード例 #3
0
        public void TestFromMessageString()
        {
            var          hash      = new HashtableMessage();
            const string MsgString = "15Unit1227This is the data for unit 1210TagNumber215tag 2";

            hash.FromMessageString(MsgString);

            Assert.AreEqual("This is the data for unit 1", hash["Unit1"]);
            Assert.AreEqual("tag 2", hash["TagNumber2"]);

            Assert.AreEqual(2, hash.Keys.Count);
            Assert.AreEqual(2, hash.Count);
        }
コード例 #4
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);
        }
コード例 #5
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"));
        }