예제 #1
0
        partial void ToModelPostprocessing(LedgerTransactionDto dto, ref LedgerTransaction model)
        {
            // Inheritance could be better handled.
            var balanaceTransaction = model as BankBalanceAdjustmentTransaction;

            if (balanaceTransaction != null)
            {
                balanaceTransaction.BankAccount = this.accountTypeRepo.GetByKey(dto.Account);
            }
        }
 public DtoToLedgerTransactionMapperTest()
 {
     TestData = new LedgerTransactionDto
     {
         Id = TransactionId,
         Amount = -123.99M,
         Narrative = "Foo bar.",
         TransactionType = typeof(CreditLedgerTransaction).FullName
     };
 }
예제 #3
0
        partial void ToDtoPostprocessing(ref LedgerTransactionDto dto, LedgerTransaction model)
        {
            dto.TransactionType = model.GetType().FullName;
            // Inheritance could be better handled.
            var bankBalanceTransaction = model as BankBalanceAdjustmentTransaction;

            if (bankBalanceTransaction != null)
            {
                dto.Account = bankBalanceTransaction.BankAccount.Name;
            }
        }
        public void ShouldMapAccountTypeForBalanceAdjustmentTransaction()
        {
            TestData = new LedgerTransactionDto
            {
                Id = TransactionId,
                Amount = -123.99M,
                Narrative = "Foo bar.",
                Account = StatementModelTestData.ChequeAccount.Name,
                TransactionType = typeof(BankBalanceAdjustmentTransaction).FullName
            };
            var subject = new Mapper_LedgerTransactionDto_LedgerTransaction(new LedgerTransactionFactory(), new InMemoryAccountTypeRepository());
            Result = subject.ToModel(TestData);

            Assert.AreEqual(StatementModelTestData.ChequeAccount.Name, ((BankBalanceAdjustmentTransaction)Result).BankAccount.Name);
        }
예제 #5
0
 // ReSharper disable once RedundantAssignment
 partial void ModelFactory(LedgerTransactionDto dto, ref LedgerTransaction model)
 {
     model = this.transactionFactory.Build(dto.TransactionType, dto.Id);
 }
예제 #6
0
 partial void ToModelPostprocessing(LedgerTransactionDto dto, ref BankBalanceAdjustmentTransaction model)
 {
     model.BankAccount = this.accountTypeRepo.GetByKey(dto.Account) ?? this.accountTypeRepo.GetByKey(AccountTypeRepositoryConstants.Cheque);
 }
예제 #7
0
 partial void ToDtoPostprocessing(ref LedgerTransactionDto dto, BankBalanceAdjustmentTransaction model)
 {
     dto.Account         = model.BankAccount.Name;
     dto.TransactionType = model.GetType().FullName;
 }
 partial void ToModelPostprocessing(LedgerTransactionDto dto, ref LedgerTransaction model)
 {
     // Inheritance could be better handled.
     var balanaceTransaction = model as BankBalanceAdjustmentTransaction;
     if (balanaceTransaction != null)
     {
         balanaceTransaction.BankAccount = this.accountTypeRepo.GetByKey(dto.Account);
     }
 }
 partial void ToDtoPostprocessing(ref LedgerTransactionDto dto, LedgerTransaction model)
 {
     dto.TransactionType = model.GetType().FullName;
     // Inheritance could be better handled.
     var bankBalanceTransaction = model as BankBalanceAdjustmentTransaction;
     if (bankBalanceTransaction != null)
     {
         dto.Account = bankBalanceTransaction.BankAccount.Name;
     }
 }
예제 #10
0
 // ReSharper disable once RedundantAssignment
 partial void ModelFactory(LedgerTransactionDto dto, ref LedgerTransaction model)
 {
     model = this.transactionFactory.Build(dto.TransactionType, dto.Id);
 }
예제 #11
0
 partial void ToModelPostprocessing(LedgerTransactionDto dto, ref BankBalanceAdjustmentTransaction model)
 {
     model.BankAccount = this.accountTypeRepo.GetByKey(dto.Account) ?? this.accountTypeRepo.GetByKey(AccountTypeRepositoryConstants.Cheque);
 }
예제 #12
0
 partial void ToDtoPostprocessing(ref LedgerTransactionDto dto, BankBalanceAdjustmentTransaction model)
 {
     dto.Account = model.BankAccount.Name;
     dto.TransactionType = model.GetType().FullName;
 }