public void Can_save_and_load_country_with_restrictions() { var country = new Country { Name = "United States", AllowsBilling = true, AllowsShipping = true, TwoLetterIsoCode = "US", ThreeLetterIsoCode = "USA", NumericIsoCode = 1, SubjectToVat = true, Published = true, DisplayOrder = 1 }; country.RestrictedShippingMethods.Add ( new ShippingMethod() { Name = "By train", } ); var fromDb = SaveAndLoadEntity(country); fromDb.ShouldNotBeNull(); fromDb.Name.ShouldEqual("United States"); fromDb.RestrictedShippingMethods.ShouldNotBeNull(); (fromDb.RestrictedShippingMethods.Count == 1).ShouldBeTrue(); fromDb.RestrictedShippingMethods.First().Name.ShouldEqual("By train"); }
public void Can_save_and_load_country() { var country = new Country { Name = "United States", AllowsBilling = true, AllowsShipping = true, TwoLetterIsoCode = "US", ThreeLetterIsoCode = "USA", NumericIsoCode = 1, SubjectToVat = true, Published = true, DisplayOrder = 1 }; var fromDb = SaveAndLoadEntity(country); fromDb.ShouldNotBeNull(); fromDb.Name.ShouldEqual("United States"); fromDb.AllowsBilling.ShouldEqual(true); fromDb.AllowsShipping.ShouldEqual(true); fromDb.TwoLetterIsoCode.ShouldEqual("US"); fromDb.ThreeLetterIsoCode.ShouldEqual("USA"); fromDb.NumericIsoCode.ShouldEqual(1); fromDb.SubjectToVat.ShouldEqual(true); fromDb.Published.ShouldEqual(true); fromDb.DisplayOrder.ShouldEqual(1); }
/// <summary> /// Deletes a country /// </summary> /// <param name="country">Country</param> public virtual void DeleteCountry(Country country) { if (country == null) throw new ArgumentNullException("country"); _countryRepository.Delete(country); _cacheManager.RemoveByPattern(COUNTRIES_PATTERN_KEY); //event notification _eventPublisher.EntityDeleted(country); }
public void Can_save_and_load_country_with_states() { var country = new Country { Name = "United States", AllowsBilling = true, AllowsShipping = true, TwoLetterIsoCode = "US", ThreeLetterIsoCode = "USA", NumericIsoCode = 1, SubjectToVat = true, Published = true, DisplayOrder = 1 }; country.StateProvinces.Add ( new StateProvince() { Name = "California", Abbreviation = "CA", DisplayOrder = 1 } ); var fromDb = SaveAndLoadEntity(country); fromDb.ShouldNotBeNull(); fromDb.Name.ShouldEqual("United States"); fromDb.StateProvinces.ShouldNotBeNull(); (fromDb.StateProvinces.Count == 1).ShouldBeTrue(); fromDb.StateProvinces.First().Name.ShouldEqual("California"); }
public static Country ToEntity(this CountryModel model, Country destination) { return Mapper.Map(model, destination); }
/// <summary> /// Get Paypal country code /// </summary> /// <param name="country">Country</param> /// <returns>Paypal country code</returns> protected CountryCodeType GetPaypalCountryCodeType(Country country) { CountryCodeType payerCountry = CountryCodeType.US; try { payerCountry = (CountryCodeType)Enum.Parse(typeof(CountryCodeType), country.TwoLetterIsoCode); } catch { } return payerCountry; }
protected void UpdateLocales(Country country, CountryModel model) { foreach (var localized in model.Locales) { _localizedEntityService.SaveLocalizedValue(country, x => x.Name, localized.Name, localized.LanguageId); } }