public void Consume(T message) { try { ICreateEdiContentFrom <T> ediContentCreator = _businessPartnerResolver.ResolveFrom(message); if (ediContentCreator == null) { throw new InvalidOperationException("No matching document creator was found for business partner " + message.BusinessPartnerCode + ", Document ID " + message.DocumentId); } EDITransmissionPackage package = _createEdiDocumentFrom.CreateDocumentWith(ediContentCreator, message); checkForProblems(message, package); _ediDocumentSaver.Save(package); //_ediDocumentSaver.SaveAsXml(package); Logger.Info(this, "Document Saved: " + package.GetInterchangeControl().Value); _postConsumeAction.Execute(message); } catch (Exception ex) { Logger.Error(this, "Error processing message", ex); throw; } }
public void can_save_edi_documents() { //ARRANGE var document = new Mock <EDIXmlInterchangeControl>(_factory.Object); var package = new EDITransmissionPackage(document.Object, BusinessPartner.FedEx); // _configuration.Setup(x => x.WorkingFolder).Returns("WorkingFolder"); // _configuration.Setup(x => x.UploadFolder).Returns("UploadFolder"); document.Setup(x => x.ControlNumber).Returns("1"); document.SetupGet(x => x.FunctionalID).Returns("SH"); //ACT _sut.Save(package); //ASSERT // _configuration.VerifyAll(); document.VerifyAll(); }