public void CreateMonthlyStatementWithRecurringInformation() { List <RecurringTransaction> recurringTransactions = new List <RecurringTransaction>() { new RecurringTransaction("Conta de Luz", -200m, 15, new ClassificationInfo("Moradia", ClassificationInfo.ResponsibleAll, Importance.Essential)) }; List <TransactionLine> statements = TransactionLineBuilder.BuildList() .Add(TransactionLineBuilder.BuildExecutedRecurringTransactionLine(-100m, description: "Conta de Luz", day: 15, month: 4)) .Add(-800m, day: 22, month: 4) .Add(1_000m, day: 07, month: 4) .Add(-800m, day: 22, month: 6) .Add(1_000m, day: 07, month: 6) .Build(); List <MonthlyView> months = new MonthlyViewBuilder(statements, new List <IViewerPipeline>() { new RecurringTransactionsPipeline(recurringTransactions, new YearMonth(2019, 7)) }) .Build(100m); Assert.Equal(4, months.Count); ValitadeMonth(months[0], 4, 100m, 200m, 3); ValitadeMonth(months[1], 5, 200m, 0m, 1); ValitadeMonth(months[2], 6, 0m, 0m, 3); ValitadeMonth(months[3], 7, 0m, -200m, 1); }
public void CreateRecurringTransactionsConsideringExecutedRecurringTransactions() { List <TransactionLine> lines = TransactionLineBuilder.BuildList() .Add(TransactionLineBuilder.BuildExecutedRecurringTransactionLine(TransactionLineBuilder.DefaultAmount, month: 4)) .Add(TransactionLineBuilder.BuildExecutedRecurringTransactionLine(TransactionLineBuilder.DefaultAmount, month: 5)) .Add(TransactionLineBuilder.DefaultAmount, month: 6) .Add(TransactionLineBuilder.DefaultAmount, month: 7) .Build(); RecurringTransaction transaction = TransactionLineBuilder.BuildRecurringTransaction(TransactionLineBuilder.DefaultAmount); transaction.IncludeLines(lines, new YearMonth(2019, 4), new YearMonth(2019, 7)); Assert.Equal(6, lines.Count); RecurringTransactionLine line = GetFist <RecurringTransactionLine>(lines); TransactionLineBuilder.ValidateTransactionLine(line, date: new DateTime(2019, 6, TransactionLineBuilder.DefaultDay)); }