public void CanSupportMultipleBudgetEntries() { BudgetEntryMonthly anotherMonthly = new BudgetEntryMonthly(25.00, "Water Bill", BudgetType.Utilities_WaterSewerWaste); _budget.AddEntry(_monthlyEntry); _budget.AddEntry(anotherMonthly); Assert.That(_budget.TotalExpenses, Is.EqualTo((30.00 + 25.00) * 12)); Assert.That(_budget.MonthlyExpenses(3), Is.EqualTo(30.00 + 25.00)); }
public static BudgetEntry CreateBudgetEntry(params string[] components) { BudgetEntry result = null; double amount; string label; BudgetType budgetType; int month; string dayStart; int weekPeriod; int weekMax; string type; GetNextValueAndAdvance(ref components, out type); GetCommonParameters(ref components, out amount, out label, out budgetType); switch (type) { case "Annual": GetNextValueAndAdvance(ref components, out month); result = new BudgetEntryAnnual(amount, month, label, budgetType); break; case "BiAnnual": GetNextValueAndAdvance(ref components, out month); result = new BudgetEntryBiAnnual(amount, month, label, budgetType); break; case "Monthly": result = new BudgetEntryMonthly(amount, label, budgetType); break; case "BiMonthly": GetNextValueAndAdvance(ref components, out month); result = new BudgetEntryBiMonthly(amount, month, label, budgetType); break; case "Weekly": GetNextValueAndAdvance(ref components, out dayStart); GetNextValueAndAdvance(ref components, out weekPeriod); GetNextValueAndAdvance(ref components, out weekMax); result = new BudgetEntryWeekly(amount, label, budgetType, weekPeriod, dayStart, weekMax); break; case "Daily": GetNextValueAndAdvance(ref components, out dayStart); result = new BudgetEntryDaily(amount, label, budgetType, dayStart); break; default: throw new ArgumentException($"Invalid Budget Entry Type {type}"); } return(result); }
public BudgetEntryMonthlyDto(BudgetEntryMonthly budgetEntry) : base(budgetEntry) { }
public void SetUp() { _budget = new Budget("TestBudget"); _monthlyEntry = new BudgetEntryMonthly(30.00, "Gas Bill", BudgetType.Utilities_Gas); }