public static BudgetGroupPresentation Build(BudgetGroup group) { if (group == null) { throw new ArgumentNullException(nameof(group)); } var budget = BudgetBuilder.Build(); // TODO: a map pattern may be helpful here instead of the long if/if else/else, with names or other id as constants if (group.Name == budget.IncomeGroup.Name) { return(IncomeGroupPresentation); } if (@group.Name == budget.HousingGroup.Name) { return(HousingGroupPresentation); } if (@group.Name == budget.TransportationGroup.Name) { return(TransportationGroupPresentation); } if (@group.Name == budget.FoodGroup.Name) { return(FoodGroupPresentation); } if (@group.Name == budget.PersonalGroup.Name) { return(PersonalGroupPresentation); } if (@group.Name == budget.DebtGroup.Name) { return(DebtGroupPresentation); } if (@group.Name == budget.GivingGroup.Name) { return(GivingGroupPresentation); } if (@group.Name == budget.BasicExpensesDisplayGroup.Name) { return(BasicExpensesDisplayGroup); } throw new ArgumentException($"Group `{@group.Name}` was not in budget or does not have a presentation"); }
public static OnboardingProfile Build() => Build(BudgetBuilder.Build());