public void can_split_file_contents() { _lst.Add(new Segment { Contents = "ISA*00* *00* *ZZ*SLRSCOREGTWY *12*EEC5122516063 *071031*0925*U*00401*000000007*0*P*~~", Label = SegmentLabel.InterchangeLabel }); _lst.Add(new Segment { Contents = "GS*PO*SLR010*EEC5122516063*20071031*0925*7*X*004010~", Label = SegmentLabel.GroupLabel }); _lst.Add(new Segment { Contents = "GE*1*7~", Label = SegmentLabel.GroupClose }); _lst.Add(new Segment { Contents = "IEA*1*000000007~", Label = SegmentLabel.InterchangeClose }); _lst.Add(new Segment { Contents = "ISA*00* *00* *ZZ*SLRSCOREGTWY *12*EEC5122516063 *071031*0925*U*00401*000000008*0*P*~~", Label = SegmentLabel.InterchangeLabel }); _lst.Add(new Segment { Contents = "GS*PO*SLR010*EEC5122516063*20071031*0925*7*X*004010~", Label = SegmentLabel.GroupLabel }); _lst.Add(new Segment { Contents = "GE*1*7~", Label = SegmentLabel.GroupClose }); _lst.Add(new Segment { Contents = "IEA*1*000000008~", Label = SegmentLabel.InterchangeClose }); _lst.Add(new Segment { Contents = "ISA*00* *00* *ZZ*SLRSCOREGTWY *12*EEC5122516063 *071031*0925*U*00401*000000009*0*P*~~", Label = SegmentLabel.InterchangeLabel }); _lst.Add(new Segment { Contents = "GS*PO*SLR010*EEC5122516063*20071031*0925*7*X*004010~", Label = SegmentLabel.GroupLabel }); _lst.Add(new Segment { Contents = "GE*1*7~", Label = SegmentLabel.GroupClose }); _lst.Add(new Segment { Contents = "IEA*1*000000009~", Label = SegmentLabel.InterchangeClose }); _lst.Add(new Segment { Contents = "ISA*00* *00* *ZZ*SLRSCOREGTWY *12*EEC5122516063 *071031*0925*U*00401*000000010*0*P*~~", Label = SegmentLabel.InterchangeLabel }); _lst.Add(new Segment { Contents = "GS*PO*SLR010*EEC5122516063*20071031*0925*7*X*004010~", Label = SegmentLabel.GroupLabel }); _lst.Add(new Segment { Contents = "GE*1*7~", Label = SegmentLabel.GroupClose }); _lst.Add(new Segment { Contents = "IEA*1*000000010~", Label = SegmentLabel.InterchangeClose }); var result = _sut.SplitByInterchange(new EdiSegmentCollection(_lst, "*")); Assert.That(result.Count() == 4); }
public EdiFileInfo Read(EdiSegmentCollection segments) { var interchanges = _hierarchySplitter.SplitByInterchange(segments); return(new EdiFileInfo(interchanges)); }