예제 #1
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);
        }
예제 #2
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;
        }