public void TearDown() { DynamicModuleManager dynamicModuleManager = DynamicModuleManager.GetManager(); var hotel = dynamicModuleManager .GetDataItems(TypeResolutionService.ResolveType(HierarchicalDynamicContentTests.HotelType)) .FirstOrDefault(x => x.Id == HierarchicalDynamicContentTests.HotelId); var restaurant = dynamicModuleManager .GetDataItems(TypeResolutionService.ResolveType(HierarchicalDynamicContentTests.RestaurantType)) .FirstOrDefault(x => x.Id == HierarchicalDynamicContentTests.RestaurantId); var city = dynamicModuleManager .GetDataItems(TypeResolutionService.ResolveType(HierarchicalDynamicContentTests.CityType)) .FirstOrDefault(x => x.Id == HierarchicalDynamicContentTests.CityId); var festival = dynamicModuleManager .GetDataItems(TypeResolutionService.ResolveType(HierarchicalDynamicContentTests.FestivalType)) .FirstOrDefault(x => x.Id == HierarchicalDynamicContentTests.FestivalId); var country = dynamicModuleManager .GetDataItems(TypeResolutionService.ResolveType(HierarchicalDynamicContentTests.CountryType)) .FirstOrDefault(x => x.Id == HierarchicalDynamicContentTests.CountryId); if (hotel != null) { HierarchicalDynamicContentTests.DeleteDataItem(hotel, dynamicModuleManager); } if (restaurant != null) { HierarchicalDynamicContentTests.DeleteDataItem(restaurant, dynamicModuleManager); } if (festival != null) { HierarchicalDynamicContentTests.DeleteDataItem(festival, dynamicModuleManager); } if (city != null) { HierarchicalDynamicContentTests.DeleteCity(city, dynamicModuleManager); } if (country != null) { HierarchicalDynamicContentTests.DeleteCountry(country, dynamicModuleManager); } }
private static void DeleteCity(DynamicContent city, DynamicModuleManager dynamicModuleManager) { var restaurants = city.GetChildItems(HierarchicalDynamicContentTests.RestaurantType); var hotels = city.GetChildItems(HierarchicalDynamicContentTests.RestaurantType); if (hotels != null) { foreach (var hotel in hotels) { HierarchicalDynamicContentTests.DeleteDataItem(hotel, dynamicModuleManager); } } if (restaurants != null) { foreach (var restaurant in restaurants) { HierarchicalDynamicContentTests.DeleteDataItem(restaurant, dynamicModuleManager); } } HierarchicalDynamicContentTests.DeleteDataItem(city, dynamicModuleManager); }
private static void DeleteCountry(DynamicContent country, DynamicModuleManager dynamicModuleManager) { var cities = country.GetChildItems(HierarchicalDynamicContentTests.CityType); var festivals = country.GetChildItems(HierarchicalDynamicContentTests.FestivalType); if (festivals != null) { foreach (var festival in festivals) { HierarchicalDynamicContentTests.DeleteDataItem(festival, dynamicModuleManager); } } if (cities != null) { foreach (var city in cities) { HierarchicalDynamicContentTests.DeleteCity(city, dynamicModuleManager); } } HierarchicalDynamicContentTests.DeleteDataItem(country, dynamicModuleManager); }