I’ve just now updated my Pipeline
Testing Library
. In this version, I’ve created my own mock IPipelineContext[Ex]
implementation, to support configuring some functionality not previously available:

  1. You can now configure at the pipeline level the thumbprint for the Group Signing Certificate
    so that it is returned from IPipelineContext.GroupSigningCertificate to pipeline components.
    Here’s how you’d configure it:

    SendPipelineWrapper pipeline = PipelineFactory.CreateEmptySendPipeline();

    pipeline.GroupSigningCertificate = “….”;

  2. Now transactional support is available for pipeline components if you enable it (it’s
    disabled by default). If you do enable it, then components will get a valid DTC transaction
    returned from IPipelineContextEx.GetTransaction(). I’m not 100% comfortable with this,
    but it can be useful in a few scenarios (see below for one such one). To enable it,
    call the EnableTransactions() method on the pipeline wrapper object just before calling
    Execute().

The reason why I implemented the transactional support in the pipeline context mock
object is that some components require it. In particular, it turns out that the BizTalk
Framework Disassembler Component (BtfDasmComp) will not work unless the pipeline context
returns a valid transaction from IPipelineContextEx.GetTransaction().  With this
update, you can now test pipelines that use the BtfDasmComp component, though be aware
that the transaction object is then used to access some of the biztalk databases (I’m
not exactly sure yet what for, though). Here’s an example piece of code with such
a trick:

ReceivePipelineWrapper pipeline = PipelineFactory.CreateEmptyReceivePipeline();

pipeline.AddComponent(new BtfDasmComp(), PipelineStage.Disassemble);

FixEncodingComponent fix = new FixEncodingComponent();

fix.Encoding = Encoding.Unicode;

pipeline.AddComponent(fix, PipelineStage.Decode);

 

pipeline.EnableTransactions();

 

Stream input = new FileStream(@”e:\temp\BtfDasmTest\BOBUILDING_SITE2.xml”, FileMode.Open);

IBaseMessage inputMsg = MessageHelper.CreateFromStream(input);

 

MessageCollection outputMsgs = pipeline.Execute(inputMsg);