Пример #1
0
//        public const int DATETIME_QUALIFIER = 374;
//        public const int SCHED_QTY = 380;
//        public const int NUM_UNITS_SHIPPED = 382;
//        public const int TERMS_NET_DAYS = 386;
//        public const int ROUTING = 387;
//        public const int SHIPMENTID = 396;
//        public const int UNIT_COUNT = 405;
//        public const int RESPONSIBLE_AGENCY_CODE = 455;
//        public const int FUNCTIONAL_ID = 479;
//        public const int GS_VERSION = 480;
//        public const int AMT_QUALIFIER_CODE = 522;
//        public const int AGENCY_QUAL_CODE = 559;
//        public const int SAC_AMT = 601;
//        public const int TDS_AMT = 610;
//        public const int HL_ID = 628;
//        public const int BASIS_OF_UP_CODE = 639;
//        public const int TRANSACTION_TYPE_CODE = 640;
//        public const int RELATIONSHIP_CODE = 662;
//        public const int LINE_ITEM_STATUS_CODE = 668;
//        public const int CHANGE_TYPE_CODE = 670;
//        public const int QTY_LEFT_TO_REC = 671;
//        public const int INTERCHANGE_VERSION_ID = 703;
//        public const int ISA_ID_QUALIFIER = 704;
//        public const int ISA_SEND_ID = 705;
//        public const int ISA_REC_ID = 706;
//        public const int INTERCHANGE_CONTROL_NUM = 709;
//        public const int ISA_STANDARDS_ID = 726;
//        public const int HL_PARENT_ID = 734;
//        public const int HL_LEVEL_CODE = 735;
//        public const int AUTH_INFO_QUALIFIER = 744;
//        public const int AUTH_INFO = 745;
//        public const int SECURITY_INFO_QUAL = 746;
//        public const int SECURITY_INFO = 747;
//        public const int TEST_INDICATOR = 748;
//        public const int ACK = 749;
//        public const int MONETARY_AMT = 782;
//        public const int INNER_PACK_COUNT = 810;
        //public const int SOURCE_SUBQUAL = 822;
        //public const int PALLET_TYPE = 883;
        //public const int MESSAGE = 933;
        //public const int TAX_TYPE_CODE = 963;
        //public const int HIERARCHICAL_STRUCT_CODE = 1005;
        //public const int INDUSTRY_CODE = 1271;
        //public const int SAC_CODE = 1300;

        public EDIXmlElement(string name, string value, EdiXmlBuildValues ediXmlBuildValues)
            : base(EdiStructureNameConstants.Element)
        {
            Label = name;
            Add(new XElement("delimiter", ediXmlBuildValues.ElementDelimiter));
            Add(new XElement("elementValue", value));
        }
        public void can_consume_shipped_order_message()
        {
            //ARRANGE
            var message = new OrderHasBeenShippedMessage();
            message.Add(new ShippedLine());
            var ediContentCreator = new Mock<ICreateEdiContentFrom<OrderHasBeenShippedMessage>>();
            var buildValues = new EdiXmlBuildValues {ElementDelimiter = "~", SegmentDelimiter = "\n"};
            //            ediContentCreator.Setup(c => c.ReceiverId).Returns("xxxi");
            //            ediContentCreator.Setup(c => c.ControlNumber).Returns(62);
            //            ediContentCreator.Setup(c => c.EdiXmlBuildValues).Returns(buildValues);
            //            ediContentCreator.Setup(c => c.FunctionalId).Returns("PO");

            _resolver.Setup(r => r.GetBuildValueFactoryFor(BusinessPartner.FedEx)).Returns(new FedExBuildValueFactory());
            _businessPartnerResolver.Setup(x => x.ResolveFrom(message)).Returns(ediContentCreator.Object);
            var document = new EDIXmlInterchangeControl(_seg);
            _ediDocumentCreator.Setup(x => x.CreateDocumentWith(ediContentCreator.Object, message))
                .Returns(new EDITransmissionPackage(document, BusinessPartner.FedEx));
            _ediDocumentSaver.Setup(x => x.Save(It.IsAny<EDITransmissionPackage>()));
            _acceptMessages.Setup(x => x.Accept(message)).Returns(true);

            //ACT
            _sut.Consume(message);

            //ASSERT
            _ediDocumentSaver.VerifyAll();
            _ediDocumentCreator.VerifyAll();
            _businessPartnerResolver.VerifyAll();
        }
 private IEnumerable<EDIXmlElement> emptyPair(string segmentLabel, EdiXmlBuildValues buildValues)
 {
     return new List<EDIXmlElement>
                   {
                       new EDIXmlElement(GetQualifierElementName(segmentLabel), "", buildValues),
                       new EDIXmlElement(GetCodeElementName(segmentLabel), "", buildValues)
                   };
 }
Пример #4
0
 private IEnumerable <EDIXmlElement> emptyPair(string segmentLabel, EdiXmlBuildValues buildValues)
 {
     return(new List <EDIXmlElement>
     {
         new EDIXmlElement(GetQualifierElementName(segmentLabel), "", buildValues),
         new EDIXmlElement(GetCodeElementName(segmentLabel), "", buildValues)
     });
 }
 public IEnumerable<EDIXmlElement> GetQualfierValuePair(string segmentLabel, EdiXmlBuildValues buildValues)
 {
     if (!IsValidPair()) return emptyPair(segmentLabel, buildValues);
     return new List<EDIXmlElement>
                   {
                       new EDIXmlElement(GetQualifierElementName(segmentLabel), qualifier, buildValues),
                       new EDIXmlElement(GetCodeElementName(segmentLabel), value, buildValues)
                   };
 }
        public void can_get_correct_edi_value()
        {
            var ediXmlBuildValues = new EdiXmlBuildValues {ElementDelimiter = "~", SegmentDelimiter = "\n"};

            var seg = new EDIXmlSegment("ST", ediXmlBuildValues) {Value = "hello"};
            var el = new EDIXmlElement("ST01", "hello", ediXmlBuildValues);
            Assert.That(seg.EDIValue() == "");
            Assert.That(el.EDIValue() == "hello");
        }
Пример #7
0
 public EDIXmlSegment(string lbl, EdiXmlBuildValues ediXmlBuildValues)
     : base(EdiStructureNameConstants.Segment)
 {
     Label = lbl;
     base.Add(new XElement("label",lbl));
     _element_list = new EDIXmlContainer("elementList");
     base.Add(_element_list);
     base.Add(new XElement("ediSegmentDelimiter", ediXmlBuildValues.SegmentDelimiter));
 }
Пример #8
0
 public EDIXmlSegment(string lbl, EdiXmlBuildValues ediXmlBuildValues)
     : base(EdiStructureNameConstants.Segment)
 {
     Label = lbl;
     base.Add(new XElement("label", lbl));
     _element_list = new EDIXmlContainer("elementList");
     base.Add(_element_list);
     base.Add(new XElement("ediSegmentDelimiter", ediXmlBuildValues.SegmentDelimiter));
 }
Пример #9
0
 public IEnumerable <EDIXmlElement> GetQualfierValuePair(string segmentLabel, EdiXmlBuildValues buildValues)
 {
     if (!IsValidPair())
     {
         return(emptyPair(segmentLabel, buildValues));
     }
     return(new List <EDIXmlElement>
     {
         new EDIXmlElement(GetQualifierElementName(segmentLabel), qualifier, buildValues),
         new EDIXmlElement(GetCodeElementName(segmentLabel), value, buildValues)
     });
 }
 public EdiXmlBuildValues GetValues()
 {
     if(_buildValues == null)
         _buildValues = new EdiXmlBuildValues()
                            {
                                ElementDelimiter = "~",
                                SegmentDelimiter = "\n",
                                FunctionGroupReceiverID = "055001924VA",
                                InterchangeReceiverQualifier = "ZZ",
                                InterchangeReceiverID = "055001924VA",
                                InterchangeSenderQualifier = "12",
                                InterchangeSenderID = "EEC5122516063",
                                Transport = TransportAgent.Initech
                            };
     return _buildValues;
 }
        public void can_get_envelopes()
        {
            var ediXmlBuildValues = new EdiXmlBuildValues {ElementDelimiter = "~", SegmentDelimiter = "\n"};

            var root = new XElement("file");
            var ic = new EDIXmlInterchangeControl(_seg);
            var grp = new EDIXmlFunctionGroup(_seg);
            grp.AddTransactionSet(new EDIXmlTransactionSet(_seg));
            grp.AddTransactionSet(new EDIXmlTransactionSet(_seg));
            ic.AddFunctionGroup(grp);
            root.Add(ic);
            IEnumerable<XElement> ic_s = root.EDIInterchangeControls();
            foreach (EDIXmlInterchangeControl i in ic_s)
            {
                IEnumerable<XElement> grp_s = i.EDIFunctionGroups();
                foreach (EDIXmlFunctionGroup g in grp_s)
                {
                    List<XElement> ts_s = g.EDITransactions().ToList();
                    foreach (EDIXmlTransactionSet t in ts_s)
                        Assert.That(t.Label == "ST");
                }
            }
            //Assert.That(root.EDINodes("ISA").ToList().Count == 1);
        }
Пример #12
0
 //        public const int DATETIME_QUALIFIER = 374;
 //        public const int SCHED_QTY = 380;
 //        public const int NUM_UNITS_SHIPPED = 382;
 //        public const int TERMS_NET_DAYS = 386;
 //        public const int ROUTING = 387;
 //        public const int SHIPMENTID = 396;
 //        public const int UNIT_COUNT = 405;
 //        public const int RESPONSIBLE_AGENCY_CODE = 455;
 //        public const int FUNCTIONAL_ID = 479;
 //        public const int GS_VERSION = 480;
 //        public const int AMT_QUALIFIER_CODE = 522;
 //        public const int AGENCY_QUAL_CODE = 559;
 //        public const int SAC_AMT = 601;
 //        public const int TDS_AMT = 610;
 //        public const int HL_ID = 628;
 //        public const int BASIS_OF_UP_CODE = 639;
 //        public const int TRANSACTION_TYPE_CODE = 640;
 //        public const int RELATIONSHIP_CODE = 662;
 //        public const int LINE_ITEM_STATUS_CODE = 668;
 //        public const int CHANGE_TYPE_CODE = 670;
 //        public const int QTY_LEFT_TO_REC = 671;
 //        public const int INTERCHANGE_VERSION_ID = 703;
 //        public const int ISA_ID_QUALIFIER = 704;
 //        public const int ISA_SEND_ID = 705;
 //        public const int ISA_REC_ID = 706;
 //        public const int INTERCHANGE_CONTROL_NUM = 709;
 //        public const int ISA_STANDARDS_ID = 726;
 //        public const int HL_PARENT_ID = 734;
 //        public const int HL_LEVEL_CODE = 735;
 //        public const int AUTH_INFO_QUALIFIER = 744;
 //        public const int AUTH_INFO = 745;
 //        public const int SECURITY_INFO_QUAL = 746;
 //        public const int SECURITY_INFO = 747;
 //        public const int TEST_INDICATOR = 748;
 //        public const int ACK = 749;
 //        public const int MONETARY_AMT = 782;
 //        public const int INNER_PACK_COUNT = 810;
 //public const int SOURCE_SUBQUAL = 822;
 //public const int PALLET_TYPE = 883;
 //public const int MESSAGE = 933;
 //public const int TAX_TYPE_CODE = 963;
 //public const int HIERARCHICAL_STRUCT_CODE = 1005;
 //public const int INDUSTRY_CODE = 1271;
 //public const int SAC_CODE = 1300;
 public EDIXmlElement(string name, string value, EdiXmlBuildValues ediXmlBuildValues)
     : base(EdiStructureNameConstants.Element)
 {
     Label = name;
     Add(new XElement("delimiter", ediXmlBuildValues.ElementDelimiter));
     Add(new XElement("elementValue", value));
 }
Пример #13
0
 private static void add_invoice_detail(EDIXmlSegment seg, 
     KeyValuePair<Qualifier, string> pair, 
     EdiXmlBuildValues buildValues, 
     ref int i)
 {
     var elName1 = "IT1" + i.ToString("0#");
     i++;
     var elName2 = "IT1" + i.ToString("0#");
     i++;
     seg.Add(new EDIXmlElement(elName1,pair.Key.Value, buildValues));
     seg.Add(new EDIXmlElement(elName2, pair.Value,buildValues));
 }