コード例 #1
0
        public void SeperateStringIntoSWIFTBlocks()
        {
            string str;

            using (StreamReader sr = File.OpenText(samplemessagelocation))
            {
                str = sr.ReadToEnd();
            }

            MTParser message = new MTParser();
            Dictionary <string, string> swiftBlocks = message.SeperateSWIFTFile(str.Trim());

            Assert.AreEqual(4, swiftBlocks.Count());
        }
コード例 #2
0
        public void FindBranchCode()
        {
            string str;

            using (StreamReader sr = File.OpenText(samplemessagelocation))
            {
                str = sr.ReadToEnd();
            }

            MTParser message = new MTParser();
            Dictionary <string, string> swiftBlocks = message.SeperateSWIFTFile(str.Trim());
            BasicHeader Sender = new BasicHeader(swiftBlocks);


            Assert.AreEqual("JPX", Sender.BranchCode);
        }
コード例 #3
0
        public void FindMessageType()
        {
            string str;

            using (StreamReader sr = File.OpenText(samplemessagelocation))
            {
                str = sr.ReadToEnd();
            }

            MTParser message = new MTParser();
            Dictionary <string, string> swiftBlocks = message.SeperateSWIFTFile(str.Trim());
            ApplicationHeader           Receiver    = new ApplicationHeader(swiftBlocks);



            Assert.AreEqual("548", Receiver.MessageType);
        }
コード例 #4
0
        public void SeperateTagsByColonFromSwiftString()
        {
            string str;

            using (StreamReader sr = File.OpenText(samplemessagelocationlongstring))
            {
                str = sr.ReadToEnd();
            }

            MTParser message = new MTParser();
            Dictionary <string, string> swiftBlocks = message.SeperateSWIFTFile(str.Trim());

            List <string> listOfTags = new List <string>();

            var Block4 = swiftBlocks["TextBlock"];

            listOfTags = message.Block4ToList(Block4);

            Assert.AreEqual(33, listOfTags.Count);
        }
コード例 #5
0
ファイル: SwiftMessage.cs プロジェクト: sherbacov/SwiftParser
        public void ParseSwiftMessage(string swiftFormattedFile)
        {
            MTParser      message     = new MTParser();
            TagFactory    tagFactory  = new TagFactory();
            List <string> listOfTags  = new List <string>();
            List <ITag>   listOfITags = new List <ITag>();

            Dictionary <string, string> swiftBlocks = message.SeperateSWIFTFile(swiftFormattedFile);

            listOfTags = message.Block4ToList(swiftBlocks["TextBlock"]);

            this.Block1 = new BasicHeader(swiftBlocks);
            this.Block2 = new ApplicationHeader(swiftBlocks);

            foreach (var tag in listOfTags)
            {
                listOfITags = tagFactory.CreateInstance(tag, listOfITags);
            }

            this.Block4 = listOfITags;
        }