2014-01-23 64 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中運行所有測試。