public void Test_Expenses_DurationCashFlow_GetItemListings( int year, int month, ItemTypes type, decimal expectedAmount, IEnumerable <string> expectedItems) { var startAt = new DateTime(year, month, 1); var endAt = startAt.AddMonths(1); var actual = new DurationCashFlow(startAt, endAt).GetItemListings(type); var actualItems = actual .SelectMany(item => item.Items); Assert.That(actualItems.Select(item => item.Description), Is.EquivalentTo(expectedItems)); Assert.That(actualItems.Aggregate(0.00M, (result, item) => result + item.Amount), Is.EqualTo(expectedAmount)); }
public void Test_Expenses_CashFlow_AmountTotals( int fromYear, int fromMonth, int toYear, int toMonth, decimal expectedCreditAmount, decimal expectedDebitAmount, decimal expectedDailyProfit) { var startAt = new DateTime(fromYear, fromMonth, 1); var endAt = new DateTime(toYear, toMonth, 1); var cashFlow = new DurationCashFlow(startAt, endAt); Assert.That(cashFlow.CreditAmountTotal, Is.EqualTo(expectedCreditAmount)); Assert.That(cashFlow.DebitAmountTotal, Is.EqualTo(expectedDebitAmount)); Assert.That(cashFlow.ProfitAmountTotal, Is.EqualTo(expectedCreditAmount - expectedDebitAmount)); Assert.That(cashFlow.DailyProfit, Is.EqualTo(expectedDailyProfit)); }