예제 #1
0
        public void EdifactCleaner_DoesntRemoveControlChars()
        {
            var input = DocLoader.LoadStream("samples.edifact1_with_control_chars.txt");
             var msg = MessageHelper.CreateFromStream(input);
             var cleaner = new EdifactCleaner();
             var result = Winterdom.BizTalk.PipelineTesting.Simple.Pipelines.Receive().WithDecoder(cleaner).End().Execute(msg);
             Assert.AreEqual(1, result.Count);

             var expected = new string(Utf8.GetChars(StreamToArray(DocLoader.LoadStream("samples.edifact1_with_control_chars.txt"))));
             var after = new string(Utf8.GetChars(StreamToArray(result[0].BodyPart.GetOriginalDataStream())));

             Assert.AreEqual(expected, after);
        }
예제 #2
0
        public void EdifactCleaner_OverrideCharSet()
        {
            var input = DocLoader.LoadStream("samples.edifact1.txt");
             var msg = MessageHelper.CreateFromStream(input);
             var cleaner = new EdifactCleaner
             {
                 OverrideCharSet = true,
                 TargetCharSet = EdifactCharacterSet.UNOC
             };
             var result = Winterdom.BizTalk.PipelineTesting.Simple.Pipelines.Receive().WithDecoder(cleaner).End().Execute(msg);
             Assert.AreEqual(1, result.Count);

             const string expected = "UNOC";
             var after = new string(Utf8.GetChars(StreamToArray(result[0].BodyPart.GetOriginalDataStream())));

             Assert.AreEqual(expected, after.Substring(5,4));
        }