public void AddExpenseShouldIncreaseExpenseAfterItWasAlreadyAdded() { var list = new ExpenseList(); var expenseValue = new Money(10m); list.AddExpense(new Expense(Id, expenseValue)); list.AddExpense(new Expense(Id, expenseValue)); var updatedExpense = list.GetExpense(Id); Assert.AreEqual(new Money(20m), updatedExpense.Value); }
public void AddExpenseShouldIncreaseTotalWithTheExpense() { var list = new ExpenseList(); var expense = new Money(10m); list.AddExpense(new Expense(Id, expense)); var totalExpense = list.TotalExpensesValue; Assert.AreEqual(expense, totalExpense); }
public void GetExpenseShouldReturnExpenseAfterItWasAddedWithAddExpenseUsingSameId() { var list = new ExpenseList(); var expenseValue = new Money(10m); list.AddExpense(new Expense(Id, expenseValue)); var result = list.GetExpense(Id); Assert.AreEqual(expenseValue, result.Value); }
public ExpenseList CalculateExpenses(IEnumerable <Journey> journeys) { var expenseList = new ExpenseList(); foreach (var journey in journeys) { var journeyExpense = _journeyCostPolicy.CalculateCost(journey); expenseList.AddExpense(journeyExpense); } return(expenseList); }