JsonToXmlConvertCreatesAValidXmlDocWhenRootNodePropertyIsNotSetForJsonMessagesWhichAlreadyHaveAParentTag() { //Arrange IBaseMessage inputMessage = PTL.MessageHelper.CreateFromStream(MessageHelper.LoadMessage("JsonPurchaseOrder.txt")); var jsonToXmlConverter = new JsonToXmlConverter(); PTL.ReceivePipelineWrapper testPipelineWrapper = PTL.PipelineFactory.CreateEmptyReceivePipeline(); testPipelineWrapper.AddComponent(jsonToXmlConverter, PTL.PipelineStage.Decode); //Act PTL.MessageCollection outputMessages = testPipelineWrapper.Execute(inputMessage); //Assert Assert.IsTrue(outputMessages.Count == 1); IBaseMessage outputMessage = outputMessages[0]; Assert.IsTrue(outputMessage.BodyPart.Data.Position == 0, "The stream position should be zero"); //The stream is at position zero //the following code is an Assert in itself, will throw an exception if an invalid xml is generated. var output = new XmlDocument(); output.Load(outputMessage.BodyPart.Data); Assert.IsTrue(System.String.CompareOrdinal(output.FirstChild.Name, "PO") == 0); }
public static PTL.MessageCollection Test_FF_Disassembler_Pipeline <T1>(Microsoft.BizTalk.Message.Interop.IBaseMessage iBaseMsg) { Microsoft.BizTalk.Component.Interop.IBaseComponent comp = PTL.Simple.Disassembler .FlatFile().WithValidation(false) .WithDocumentSpec <T1>().End(); PTL.ReceivePipelineWrapper pipeline = PTL.Simple.Pipelines.Receive() .WithDisassembler(comp) .WithSpec <T1>(); // Execute the send pipeline PTL.MessageCollection outputMessage = pipeline.Execute(iBaseMsg); return(outputMessage); }