public void TestInitialise() { var accountTypeRepo = new InMemoryAccountTypeRepository(); var subject = new Mapper_LedgerEntryDto_LedgerEntry(new LedgerBucketFactory(new BucketBucketRepoAlwaysFind(), accountTypeRepo), new LedgerTransactionFactory(), accountTypeRepo); Result = subject.ToDto(TestData); }
partial void ToModelPreprocessing(LedgerEntryDto dto, LedgerEntry model) { // Transactions must be done first otherwise balance will be changed by adding transactions and the balance should be read from the Dto. var transactionMapper = new Mapper_LedgerTransactionDto_LedgerTransaction(this.transactionFactory, this.accountTypeRepo); foreach (var txn in dto.Transactions) { model.AddTransactionForPersistenceOnly(transactionMapper.ToModel(txn)); } }
partial void ToModelPostprocessing(LedgerEntryDto dto, ref LedgerEntry model) { model.LedgerBucket = this.bucketFactory.Build(dto.BucketCode, dto.StoredInAccount); }
partial void ToDtoPostprocessing(ref LedgerEntryDto dto, LedgerEntry model) { dto.BucketCode = model.LedgerBucket.BudgetBucket.Code; dto.StoredInAccount = model.LedgerBucket.StoredInAccount.Name; }
partial void ToModelPreprocessing(LedgerEntryDto dto, LedgerEntry model) { // Transactions must be done first otherwise balance will be changed by adding transactions and the balance should be read from the Dto. var transactionMapper = new Mapper_LedgerTransactionDto_LedgerTransaction(this.transactionFactory, this.accountTypeRepo); foreach (var txn in dto.Transactions) { model.AddTransaction(transactionMapper.ToModel(txn)); } }
partial void ToModelPostprocessing(LedgerEntryDto dto, ref LedgerEntry model) { model.LedgerBucket = this.bucketFactory.Build(dto.BucketCode, dto.StoredInAccount); }
partial void ToDtoPostprocessing(ref LedgerEntryDto dto, LedgerEntry model) { dto.BucketCode = model.LedgerBucket.BudgetBucket.Code; dto.StoredInAccount = model.LedgerBucket.StoredInAccount.Name; }