public IDish Transform(IDishDto dishDto) { var namesAtMealTime = new Dictionary<string, string>(); var multipleAtMealTime = new Dictionary<string, bool>(); foreach (var propertyInfo in TimeOfDayProperties) { var dishTimeValue = (DishDescripionDto)propertyInfo.GetValue(dishDto); if (dishTimeValue != null) { namesAtMealTime.Add(propertyInfo.Name, dishTimeValue.Name); multipleAtMealTime.Add(propertyInfo.Name, dishTimeValue.AllowMultiple); } } return new Dish(namesAtMealTime, multipleAtMealTime); }
public IDish Transform(IDishDto dishDto) { var namesAtMealTime = new Dictionary <string, string>(); var multipleAtMealTime = new Dictionary <string, bool>(); foreach (var propertyInfo in TimeOfDayProperties) { var dishTimeValue = (DishDescripionDto)propertyInfo.GetValue(dishDto); if (dishTimeValue != null) { namesAtMealTime.Add(propertyInfo.Name, dishTimeValue.Name); multipleAtMealTime.Add(propertyInfo.Name, dishTimeValue.AllowMultiple); } } return(new Dish(namesAtMealTime, multipleAtMealTime)); }
public void Setup() { _dishDto = new DishDto(); }