Beispiel #1
0
        public void can_count_segments()
        {
            //ARRANGE

            string contents = @"ISA*00*          *00*          *ZZ*SPSMICROELEC   *12*EEC5122516063  *120626*1504*U*00401*100000001*0*P*}~GS*PO*SPSMICROELEC*EEC5122516063*20120626*1504*1001*X*004010~ST*850*1001~BEG*00*SA*25151**20120625~REF*IA*25097~PER*IC*MICHELE WALTERS*TE*000000000000000~CSH*N~DTM*010*20120701~DTM*002*20120709~DTM*001*20120725~N9*L1**PO Notes~MSG*DON CHUTES 614-527-7853~MSG*[email protected]~MSG*CELL - 614 204 3179~MSG*EDI~N1*ST*MEI/MICRO CENTER, INC.*92*033~N3*#033 IPSG FINISHED PRODUCTS*2701 CHARTER ST.  SUITE A~N4*COLUMBUS*OH*43228~PO1*001*1500*EA*2.03**VP*UNIV OUTER BOX*BP*0000060434~CTP**MSR*2.09~PID*F****POWERSPEC UNIV OUTER BOX~PO1*002*1500*EA*0.36**VP*UNIV ACCES BOX*BP*0000060467~CTP**MSR*0.37~PID*F****POWERSPEC UNIV ACCES BOX~PO1*003*1500*EA*4.12**VP*UNIV FOAM SET*BP*0000060483~CTP**MSR*4.24~PID*F****POWERSPEC UNIV FOAM SET~CTT*3~SE*27*1001~GE*1*1001~IEA*1*100000001~";

            var splitter = new SegmentSplitter();

            var segmentList = splitter.Split(contents).SegmentList.ToList();

            segmentList = segmentList.GetRange(2, 27);

            //ACT
            _sut.ProcessSegmentList(segmentList);

            //ASSERT
            Assert.That(segmentList.Count, Is.EqualTo(0));
        }
Beispiel #2
0
        public void can_process_addresses()
        {
            //ARRANGE
            var segmentList = new List <Segment>
            {
                new Segment {
                    Contents = "ST*850*0001", Label = SegmentLabel.DocumentLabel
                },
                new Segment
                {
                    Contents = "BEG*00*SA*25151**20120625", Label = "BEG".GetSegmentLabel()
                },
//                              new Segment {Contents = "N1*ST*EPS LOADING DOCK*92*SUSA", Label = "N1"},
//                              new Segment {Contents = "N3*12825 FLUSHING MEADOWS DR FL 2*STE 280", Label = "N3"},
//                              new Segment {Contents = "N3*Third Floor*", Label = "N3"},
//                              new Segment {Contents = "N3*Next to the bank*", Label = "N3"},
//                              new Segment {Contents = "N4*SAINT LOUIS*MO*638592*US", Label = "N4"},
                new Segment {
                    Contents = "SE*8*0001", Label = SegmentLabel.DocumentClose
                }
            };

            _genericParser.Setup(p => p.ProcessSegmentList(segmentList)).Returns(new OrderRequestReceivedMessage()
            {
                ControlNumber = "0001"
            });
            _genericParser.Setup(p => p.ElementDelimiter).Returns("*");
            _addrParser.Setup(x => x.ProcessAddresses(segmentList, It.IsAny <OrderRequestReceivedMessage>())).Returns(5);

            _lineParser.Setup(x => x.ProcessLines(It.IsAny <List <Segment> >(), It.IsAny <IEdiMessage>()));
            //_lineParser.Setup(x => x.SegmentCount).Returns(1);

            //ACT
            OrderRequestReceivedMessage orderRequestReceived = (OrderRequestReceivedMessage)_sut.ProcessSegmentList(segmentList).Message;

            //ASSERT
            Assert.That(segmentList.Count, Is.EqualTo(0));
            _addrParser.VerifyAll();


//            Assert.That(order.ShipToAddress.City == "SAINT LOUIS");
//            Assert.That(order.ShipToAddress.AddressName == "EPS LOADING DOCK");
//            Assert.That(order.ShipToAddress.Address1 == "12825 FLUSHING MEADOWS DR FL 2");
//            Assert.That(order.ShipToAddress.State == "MO");
//            Assert.That(order.ShipToAddress.Zip == "638592");
        }