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());
        }
        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);
        }
        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);
        }
        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
        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;
        }