Esempio n. 1
0
        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);
        }
Esempio n. 2
0
        private void configureJSONReceivePipeline(ReceivePipelineWrapper pipeline, string rootNode, string namespaceUri)
        {
            string configPath = Path.Combine(TestContext.DeploymentDirectory, "pipelineconfig.xml");

            var configDoc = XDocument.Load(configPath);

            configDoc.Descendants("RootNode").First().SetValue(rootNode);
            configDoc.Descendants("RootNodeNamespace").First().SetValue(namespaceUri);

            configDoc.Save(configPath);

            pipeline.ApplyInstanceConfig(configPath);
        }
Esempio n. 3
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);
        }