Exemplo n.º 1
0
        internal ShipMethod(Guid providerKey, Guid shipCountryKey, ProvinceCollection <IShipProvince> shipProvinces)
        {
            Mandate.ParameterCondition(Guid.Empty != providerKey, "providerKey");
            Mandate.ParameterCondition(Guid.Empty != shipCountryKey, "shipCountryKey");
            Mandate.ParameterNotNull(shipProvinces, "provinces");

            _providerKey    = providerKey;
            _shipCountryKey = shipCountryKey;
            _shipProvinces  = shipProvinces;
        }
        /// <summary>
        /// Converts a collection of <see cref="IProvince"/> to a new collection of <see cref="ITaxProvince"/>
        /// </summary>
        /// <param name="provinces">A collection of <see cref="IProvince"/></param>
        /// <returns>A collection of <see cref="ITaxProvince"/></returns>
        public static ProvinceCollection <ITaxProvince> ToTaxProvinceCollection(this IEnumerable <IProvince> provinces)
        {
            var provinceCollection = new ProvinceCollection <ITaxProvince>();

            foreach (var p in provinces)
            {
                provinceCollection.Add(new TaxProvince(p.Code, p.Name));
            }
            return(provinceCollection);
        }