예제 #1
0
        private static void RemoveTestData()
        {
            var dataContext = new RockContext();

            // Remove Defined Values for Countries
            var definedTypeService = new DefinedTypeService(dataContext);

            var countryCodeValues = new List <string> {
                CountryCodeWithMandatoryAddressRequirements, CountryCodeWithOptionalAddressRequirements, CountryCodeWithMixedAddressRequirements
            };

            definedTypeService.DeleteValues(SystemGuid.DefinedType.LOCATION_COUNTRIES, countryCodeValues);

            // Remove test locations.
            var locationService = new LocationService(dataContext);

            locationService.DeleteRange(locationService.Queryable().Where(x => countryCodeValues.Contains(x.Country)));

            dataContext.SaveChanges();
        }