public BudgetCategory AddTransaction(FinancialTransaction transaction) { if (!IsClosed) { FinancialTransactions newTransactions = new FinancialTransactions(); newTransactions.AddRange(this.transactions); newTransactions.Add(transaction); return new BudgetCategory(this.Name, this.Budget, this.IsClosed, newTransactions); } else { throw new BudgetIsClosedException(); } }
protected override void AssertType(FinancialTransaction transaction) { Assert.IsInstanceOf(typeof(WithdrawTransaction), transaction, "Should be of type WithdrawTransaction"); }
protected abstract void AssertType(FinancialTransaction transaction);