public void Can_Retreive_A_List_Of_ShipCountries_By_WarehouseCatalog() { //// Arrange var countries = new[] { new ShipCountry(_catalog.Key, _storeSettingService.GetCountryByCode("US")), new ShipCountry(_catalog.Key, _storeSettingService.GetCountryByCode("FR")), new ShipCountry(_catalog.Key, _storeSettingService.GetCountryByCode("AU")), new ShipCountry(_catalog.Key, _storeSettingService.GetCountryByCode("GB")), new ShipCountry(_catalog.Key, _storeSettingService.GetCountryByCode("TR")) }; var expected = countries.Count() + 1; // + 1 for everywhere else foreach (var country in countries) { _shipCountryService.Save(country); } //// Act var retrieved = _shipCountryService.GetShipCountriesByCatalogKey(_catalog.Key); //// Assert Assert.NotNull(retrieved); Assert.IsTrue(retrieved.Any()); Assert.AreEqual(expected, retrieved.Count()); }
/// <summary> /// Returns All ShipCountries with ShipMethods in them /// /// GET /umbraco/Merchello/ShippingMethodsApi/GetAllShipCountries/{guid} /// </summary> /// <param name="id">CatalogKey Guid to get countries for</param> public IEnumerable <ShipCountryDisplay> GetAllShipCountries(Guid id) { var countries = _shipCountryService.GetShipCountriesByCatalogKey(id); if (countries == null) { throw new HttpResponseException(Request.CreateResponse(HttpStatusCode.NotFound)); } return(countries.Select(country => country.ToShipCountryDisplay())); }
public void Can_Query_A_List_Of_GatewayProviders_By_Country() { //// Arrange var shipCountry = _shipCountryService.GetShipCountriesByCatalogKey(_catalog.Key).First(x => x.CountryCode == "US"); //// Act var gateways = _gatewayProviderService.GetGatewayProvidersByShipCountry(shipCountry); //// Assert Assert.NotNull(gateways); Assert.IsTrue(gateways.Any()); }