public void EdifactXmlCleaner_UNOBRun() { var input = DocLoader.LoadStream("samples.edifact1.xml"); var msg = MessageHelper.CreateFromStream(input); var cleaner = new EdifactXmlCleaner {TargetCharSet = EdifactCharacterSet.UNOB}; var result = Winterdom.BizTalk.PipelineTesting.Simple.Pipelines.Send().WithPreAssembler(cleaner).End().Execute(msg); var expected = new string(Utf8.GetChars(StreamToArray(DocLoader.LoadStream("samples.edifact1_cleaned.xml")))); var after = new string(Utf8.GetChars(StreamToArray(result.BodyPart.GetOriginalDataStream()))); string diff; var equals = CompareStrings(expected, after, out diff); Assert.AreEqual(string.Empty, diff); }
public void EdifactXmlCleaner_Separators() { var msg = MessageHelper.CreateFromString("<ROOT>Returns everything except the ! and the ?</ROOT>"); var cleaner = new EdifactXmlCleaner { TargetCharSet = EdifactCharacterSet.UNOC , ExtraCharsToReplace = "?!", FallbackChar = '*'}; var result = Winterdom.BizTalk.PipelineTesting.Simple.Pipelines.Send().WithPreAssembler(cleaner).End().Execute(msg); const string expected = "<?xml version=\"1.0\" encoding=\"utf-8\"?><ROOT>Returns everything except the * and the *</ROOT>"; string after; using (var reader = new StreamReader(result.BodyPart.GetOriginalDataStream(), Encoding.UTF8)) { after = reader.ReadToEnd(); } string diff; var equals = CompareStrings(expected, after, out diff); Assert.AreEqual(string.Empty, diff); }