Example #1
0
        public void CreateExecutedTransactionLine()
        {
            ExecutedTransactionLine line = new ExecutedTransactionLine(TransactionLineBuilder.BuildDefaultTransactionInfo());

            TransactionLineBuilder.ValidateTransactionLine(line, importance: Importance.NotDefined, responsible: "", category: "");
            Assert.Equal(0m, ((ExecutedTransactionLine)line).Difference);
        }
Example #2
0
        public void CreateRealizedTransactionLineFromSingleTransaction()
        {
            ExecutedTransactionLine statementLine = new ExecutedTransactionLine(TransactionLineBuilder.BuildDefaultTransactionInfo());

            TransactionLineInfo   lineInfo = new TransactionLineInfo(new DateTime(2019, 4, 12), 2_000m, "transaction description");
            SingleTransactionLine singleTransactionLine = new SingleTransactionLine(lineInfo);

            singleTransactionLine.Classify(TransactionLineBuilder.BuildDefaultClssification());

            ExecutedTransactionLine line = singleTransactionLine.Consolidate(statementLine);

            TransactionLineBuilder.ValidateTransactionLine(line, description: lineInfo.Description);
            Assert.Equal(900m, line.Difference);
        }
Example #3
0
        public void ConsolidateMultilineTransactionLine()
        {
            MultilineTransactionLine line = TransactionLineBuilder.BuildMultilineTransactionLine();

            line.Add(TransactionLineBuilder.BuildMultilineDetailTransactionLine(-300));
            line.Add(TransactionLineBuilder.BuildMultilineDetailTransactionLine(-500, "supermercado"));

            ExecutedTransactionLine statementLine = TransactionLineBuilder.BuildExecutedCreditcardTransactionLine(-1_000m);

            ExecutedMultilineTransactionLine executedLine = line.Consolidate(statementLine);

            Assert.Equal(2, executedLine.Lines.Count);

            Assert.Equal(statementLine.Amount, executedLine.Amount);
            Assert.Equal(statementLine.TransactionDate, executedLine.TransactionDate);

            Assert.Equal(line.Description, executedLine.Description);
            Assert.Equal(200m, executedLine.Difference);
        }
 public virtual ExecutedMultilineTransactionLine Consolidate(ExecutedTransactionLine statementLine)
 {
     return(new ExecutedMultilineTransactionLine(this, statementLine));
 }
 public ExecutedTransactionLine(SingleTransactionLine singleTransactionLine, ExecutedTransactionLine executedLine)
     : base(new TransactionLineInfo(executedLine.TransactionDate, executedLine.Amount, singleTransactionLine.Description))
 {
     Difference = singleTransactionLine.Amount - executedLine.Amount;
     Classify(singleTransactionLine.GetClassification());
 }
Example #6
0
 public ExecutedRecurringTransactionLine(SingleTransactionLine singleTransactionLine, ExecutedTransactionLine statementLine)
     : base(new TransactionLineInfo(statementLine.TransactionDate, statementLine.Amount, singleTransactionLine.Description))
 {
 }
 public ExecutedMultilineTransactionLine(MultilineTransactionLine multilineTransaction, ExecutedTransactionLine statementLine)
     : base(new TransactionLineInfo(statementLine.TransactionDate, statementLine.Amount, multilineTransaction.Description))
 {
     Difference = multilineTransaction.Amount - statementLine.Amount;
     _lines     = multilineTransaction.Lines.ToList();
 }