2014-01-23 65 views
0

我正在使用伟大的Winterdom BizTalk测试库来尝试测试15个记录中的平面文件的讨论。Winterdom BizTalk管道测试

接收管道在部署到BizTalk时运行良好。

这里是我的单元测试:

[DeploymentItem(@"TestData\Maps\FromCarrier\UPSSampleUpdate.csv")] 
    [TestMethod] 
    public void UPSTrackTrace_DebatchAndConvertUPSUpdateFFToXml() 
    { 

     FFDisassembler ff = Disassembler.FlatFile().WithHeaderSpec<Vasanta.Int.Carrier.Schemas.Carriers.UPS.TrackAndTrace.TandTHeader>(); 
     ff.WithDocumentSpec<Vasanta.Int.Carrier.Schemas.Carriers.UPS.TrackAndTrace.TandTBody>(); 

     ReceivePipelineWrapper pipeline = Pipelines.Receive().WithDisassembler(ff); 

     // Create the input message to pass through the pipeline 
     MemoryStream stream = new MemoryStream(); 
     using (FileStream file = new FileStream("UPSSampleUpdate.csv", FileMode.Open, FileAccess.Read)) 
     { 
      byte[] bytes = new byte[file.Length]; 
      file.Read(bytes, 0, (int)file.Length); 
      stream.Write(bytes, 0, (int)file.Length); 
     } 

     IBaseMessage inputMessage = MessageHelper.CreateFromStream(stream); 

     MessageCollection output = pipeline.Execute(inputMessage); 

     Assert.AreEqual(15, output.Count); 

    } 

运行测试提出了以​​下错误: 试验方法

Vasanta.Int.Carrier.UnitTests.Pipelines.FromCarrier.UPSUpdateFFDisassemble.UPSTrackTrace_DebatchAndConvertUPSUpdateFFToXml threw exception: 
System.Xml.XmlException: Object reference not set to an instance of an object. ---> System.NullReferenceException: Object reference not set to an instance of an object. 


And this stack trace: 
Microsoft.BizTalk.ParsingEngine.UngetBuffer.Push(String str, Int32 index, Int32 howMany) 
Microsoft.BizTalk.ParsingEngine.DataReader.Unget(String str, Int32 index, Int32 count) 
Microsoft.BizTalk.ParsingEngine.FFScanner.MatchDelimited() 
Microsoft.BizTalk.ParsingEngine.FFScanner.Match() 
Microsoft.BizTalk.ParsingEngine.FFScanner.InternalRead() 
Microsoft.BizTalk.ParsingEngine.BufferedTokenReader.Read() 
Microsoft.BizTalk.ParsingEngine.FFScanner.Read() 
Microsoft.BizTalk.ParsingEngine.Parser.Scan() 
Microsoft.BizTalk.ParsingEngine.Parser.Resume() 
Microsoft.BizTalk.ParsingEngine.Parser.Parse() 
Microsoft.BizTalk.ParsingEngine.FFReader.State.InitialState.Read(FFReader reader) 
Microsoft.BizTalk.ParsingEngine.FFReader.State.InitialState.Read(FFReader reader) 
Microsoft.BizTalk.ParsingEngine.FFReader.Read() 
Microsoft.BizTalk.Streaming.XmlTranslatorStream.ProcessXmlNodes(Int32 count) 
Microsoft.BizTalk.Streaming.XmlBufferedReaderStream.ReadInternal(Byte[] buffer, Int32 offset, Int32 count) 
Microsoft.BizTalk.Streaming.EventingReadStream.Read(Byte[] buffer, Int32 offset, Int32 count) 
Microsoft.BizTalk.Streaming.MarkableForwardOnlyEventingReadStream.ReadInternal(Byte[] buffer, Int32 offset, Int32 count) 
Microsoft.BizTalk.Streaming.EventingReadStream.Read(Byte[] buffer, Int32 offset, Int32 count) 
System.IO.StreamReader.ReadBuffer(Char[] userBuffer, Int32 userOffset, Int32 desiredChars, Boolean& readToUserBuffer) 
System.IO.StreamReader.Read(Char[] buffer, Int32 index, Int32 count) 
System.Xml.XmlTextReaderImpl.ReadData() 
System.Xml.XmlTextReaderImpl.InitTextReaderInput(String baseUriStr, Uri baseUri, TextReader input) 
System.Xml.XmlTextReaderImpl..ctor(String url, TextReader input, XmlNameTable nt) 
System.Xml.XmlTextReader..ctor(TextReader input) 
Microsoft.BizTalk.Component.XmlDasmReader.GetReader(Boolean bValidate, Stream data, Encoding encoding, SchemaList envelopeSpecNames, SchemaList documentSpecNames) 
Microsoft.BizTalk.Component.XmlDasmReader..ctor(IPipelineContext pipelineContext, IBaseMessageContext msgctx, Stream data, Encoding encoding, Boolean saveEnvelopes, XPathAnnotationCollection xac, NodeProcessor defaultProcessor, Boolean allowUnrecognizedMessage, Boolean validateDocument, SchemaList envelopeSpecNames, SchemaList documentSpecNames, MsgTypeSchema schemaList, Boolean promoteProperties, Boolean bamTracking, SuspendCurrentMessageFunction documentScanner) 
Microsoft.BizTalk.Component.XmlDasmReader.CreateReader(IPipelineContext pipelineContext, IBaseMessageContext messageContext, MarkableForwardOnlyEventingReadStream data, Encoding encoding, Boolean saveEnvelopes, Boolean allowUnrecognizedMessage, Boolean validateDocument, SchemaList envelopeSpecNames, SchemaList documentSpecNames, IFFDocumentSpec docSpecType, SuspendCurrentMessageFunction documentScanner) 
Microsoft.BizTalk.Component.FFDasmComp.Disassemble2(IPipelineContext pc, IBaseMessage inMsg) 
Microsoft.BizTalk.Component.FFDasmComp.Disassemble(IPipelineContext pc, IBaseMessage inMsg) 
Microsoft.Test.BizTalk.PipelineObjects.Stage.Execute(IPipelineContext pipelineContext, IBaseMessage inputMessage) 
Microsoft.Test.BizTalk.PipelineObjects.GenericPipeline.ExecuteSubPipeline(IPipelineContext pipelineContext, IBaseMessage inputMessage, Int32 startStageIndex, Int32 endStageIndex) 
Microsoft.Test.BizTalk.PipelineObjects.ReceivePipeline.Execute(IPipelineContext pipelineContext) 
Winterdom.BizTalk.PipelineTesting.ReceivePipelineWrapper.Execute(IBaseMessage inputMessage) 
x.Int.Carrier.UnitTests.Pipelines.FromCarrier.UPSUpdateFFDisassemble.UPSTrackTrace_DebatchAndConvertUPSUpdateFFToXml() in C:\Development\x.Int.Carrier\Dev\V1.0\Src\Solutions\Carrier\x.Int.Carrier.UnitTests\Pipelines\FromCarrier\UPSUpdateFFDisassemble.cs: line 59 

任何人都可以看到我在哪里呢?

回答

0

这可能不是你。 BizTalk运行时中存在许多“管道测试”工具未重新创建的“事物”。

您最好的选择是下载源代码并在Visual Studio中运行它,以查看它的中断位置。

附注:我在BizTalk中运行所有测试。