【问题标题】:Unit testing BizTalk pipeline with dependency to context property对依赖于上下文属性的 BizTalk 管道进行单元测试
【发布时间】:2013-07-17 09:46:31
【问题描述】:

我正在尝试使用 TestableReceivePipeline 为 BizTalk 管道构建单元测试。我已按照此处描述的步骤进行操作: Using the Unit Testing Feature with Pipelines

我尝试测试的管道有一个读取 ReceivedFileName 上下文属性的管道组件。

由于消息在测试中没有通过 FILE 适配器,因此上下文属性不存在,测试失败。

有什么方法可以在测试中注入上下文属性,即在单元测试中设置 ReceivedFileName 属性?

【问题讨论】:

    标签: unit-testing biztalk biztalk-2010


    【解决方案1】:

    在自定义管道中编写以下代码:

    // This will be the name of file.
    string filename = "NameOfFile";
    
    // myMsg is the IBaseMessage which will be the output.
    myMsg.Context.Write("ReceivedFileName", "http://schemas.microsoft.com/BizTalk/2003/file-properties", filename);
    myMsg.Context.Promote("ReceivedFileName", "http://schemas.microsoft.com/BizTalk/2003/file-properties", filename);
    

    现在您可以按照常规步骤进行“ReceivedFileName”的提升。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-09-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-01-17
      • 2021-07-07
      • 2022-08-22
      • 2018-05-10
      相关资源
      最近更新 更多