コード例 #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);
            }
        }
コード例 #2
0
 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;
            }
        }
コード例 #4
0
        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;
 }
コード例 #8
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);
     }
 }
コード例 #9
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;
     }
 }
コード例 #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;
 }