public void AddParts() { const string filePath = @"Messages\btf2_services_header.xml"; for (var i = 0; i < 2; i++) { var interchangeID = Activity.NewActivityId(); var message = new BizMockMessage(filePath); message.Promote(BizTalkFactoryProperties.EnvelopeSpecName, Schema <soap_envelope_1__1.Envelope> .AssemblyQualifiedName); message.Promote(BtsProperties.InterchangeID, interchangeID); Submit.Request(message).To(_xmlReceiveLocation); var process = TrackingDatabase.SingleProcess(p => p.InterchangeID == interchangeID && p.Name == Factory.Processes.Batching.Aggregator); Assert.That(process.MessagingSteps.Count, Is.EqualTo(2)); var inboundMessagingStep = process.MessagingSteps.Single(ms => ms.Status == TrackingStatus.Received); Assert.That(inboundMessagingStep.Name, Is.EqualTo(_xmlReceiveLocation.Name)); var outboundMessagingStep = process.MessagingSteps.Single(ms => ms.Status == TrackingStatus.Sent); Assert.That(outboundMessagingStep.Name, Is.EqualTo("BizTalk.Factory.SP1.Batching.AddPart.WCF-SQL")); // TODO find the right way: following line should not be there BizMockery.Reset(true); } }
public void ProcessSingleMessage() { const string filePath = @"Messages\btf2_services_header.xml"; var interchangeID = Activity.NewActivityId(); var message = new BizMockMessage(filePath); message.Promote(BtsProperties.InterchangeID, interchangeID); Submit.Request(message).To(_xmlReceiveLocation); Expect.One.Request.At(_xmlSendPort).Verify(new XmlMessageVerifier <btf2_services_header>()); var process = TrackingDatabase.SingleProcess(p => p.InterchangeID == interchangeID && p.Name == DefaultProcesses.Unidentified); Assert.That(process.MessagingSteps.Count, Is.EqualTo(2)); var inboundMessagingStep = process.MessagingSteps.Single(ms => ms.Status == TrackingStatus.Received); Assert.That(inboundMessagingStep.Name, Is.EqualTo(_xmlReceiveLocation.Name)); Assert.That(inboundMessagingStep.MessageSize, Is.EqualTo(new FileInfo(filePath).Length)); Assert.That(inboundMessagingStep.MessageType, Is.EqualTo(Schema <btf2_services_header> .MessageType)); var outboundMessagingStep = process.MessagingSteps.Single(ms => ms.Status == TrackingStatus.Sent); Assert.That(outboundMessagingStep.Name, Is.EqualTo(_xmlSendPort.Name)); Assert.That(outboundMessagingStep.MessageSize, Is.EqualTo(new FileInfo(filePath).Length)); Assert.That(outboundMessagingStep.MessageType, Is.EqualTo(Schema <btf2_services_header> .MessageType)); }
public void ActivityTrackingSanityCheck() { var interchangeID = Activity.NewActivityId(); var message = new BizMockMessage(@"Messages\btf2_services_header.xml"); message.Promote(BtsProperties.InterchangeID, interchangeID); Submit.Request(message).To(_xmlReceiveLocation); Expect.One.Request.At(_xmlSendPort).Verify(new XmlMessageVerifier <btf2_services_header>()); var process = TrackingDatabase.SingleProcess(p => p.InterchangeID == interchangeID && p.Name == DefaultProcesses.Unidentified); Assert.That(process.MessagingSteps.Count, Is.EqualTo(2)); var inboundMessagingStep = process.MessagingSteps.Single(ms => ms.Status == TrackingStatus.Received); Assert.That(inboundMessagingStep.Name, Is.EqualTo(_xmlReceiveLocation.Name)); Assert.That( inboundMessagingStep.Context.Properties.Any( p => p.Name == TrackingProperties.MessagingStepActivityId.Name && p.Namespace == TrackingProperties.MessagingStepActivityId.Namespace && p.Value == inboundMessagingStep.ActivityID)); Assert.That(inboundMessagingStep.Message.Body, Is.EqualTo(message.ReadBodyAsString())); var outboundMessagingStep = process.MessagingSteps.Single(ms => ms.Status == TrackingStatus.Sent); Assert.That(outboundMessagingStep.Name, Is.EqualTo(_xmlSendPort.Name)); Assert.That( outboundMessagingStep.Context.Properties.Any( p => p.Name == TrackingProperties.MessagingStepActivityId.Name && p.Namespace == TrackingProperties.MessagingStepActivityId.Namespace && p.Value == outboundMessagingStep.ActivityID)); Assert.That(outboundMessagingStep.Message.Body, Is.EqualTo(message.ReadBodyAsString())); }
public void ReleaseBatch() { const string filePath = @"Messages\ReleaseBatchContent.xml"; var interchangeID = Activity.NewActivityId(); var message = new BizMockMessage(filePath); message.Promote(BtsProperties.InterchangeID, interchangeID); Submit.Request(message).To(_xmlReceiveLocation); var process = TrackingDatabase.SingleProcess(p => p.InterchangeID == interchangeID && p.Name == Factory.Processes.Batching.Releaser); Assert.That(process.MessagingSteps.Count, Is.GreaterThan(2)); var inboundMessagingStep = process.MessagingSteps.Single(ms => ms.Status == TrackingStatus.Received); Assert.That(inboundMessagingStep.Name, Is.EqualTo(_xmlReceiveLocation.Name)); Assert.That(process.MessagingSteps.All(ms => ms.Status == TrackingStatus.Sent && ms.Name == "BizTalk.Factory.SP2.Batching.ReleaseBatch.WCF-SQL")); }
public void MessageFailureUponReceiving() { var interchangeID = Activity.NewActivityId(); var message = new BizMockMessage(@"Messages\unknown.xml"); message.Promote(BtsProperties.InterchangeID, interchangeID); Submit.Request(message).To(_xmlReceiveLocation); Expect.One.Request.At(_failSendPort); var messagingStep = TrackingDatabase.SingleMessagingStep(ms => ms.InterchangeID == interchangeID); Assert.That(messagingStep.ErrorCode, Is.Not.Empty); Assert.That(messagingStep.ErrorDescription, Is.Not.Empty); Assert.That(messagingStep.Name, Is.EqualTo(_xmlReceiveLocation.Name)); Assert.That(messagingStep.Processes.Count, Is.EqualTo(0)); Assert.That(messagingStep.Status, Is.EqualTo(TrackingStatus.FailedMessage)); Assert.That(messagingStep.Message.Body, Is.EqualTo(File.ReadAllText(@"Messages\unknown.xml"))); Assert.That(messagingStep.Context.GetProperty(BtsProperties.SendPortName).Value, Is.EqualTo(_failSendPort.Name)); }