private static void handle_addr(IAddressSegmentCreator segCreator, AddressLoop container,
                                 ISegmentFactory factory, Address address)
 {
     if (segCreator.CanProcess(address.AddressType))
     {
         segCreator.AddAddressSegmentsTo(container, factory, address);
     }
 }
        public void can_create_address_segment()
        {
            var container = new AddressLoop(_segFactory);
            Address addr = get_shipfrom_address();
            _addrSegCreator.ForEach(a => handle_addr(a, container, _segFactory, addr));
            container.Count(EdiStructureNameConstants.Segment).ShouldEqual(6);

            addr = get_shipto_address();
            _addrSegCreator.ForEach(a => handle_addr(a, container, _segFactory, addr));
            container.Count(EdiStructureNameConstants.Segment).ShouldEqual(9);

            addr = get_billto_address();
            _addrSegCreator.ForEach(a => handle_addr(a, container, _segFactory, addr));
            container.Count(EdiStructureNameConstants.Segment).ShouldEqual(12);
        }