public void Handle(TransferMoney transferMoney, int id) { var validate = new ValidateIdAndAccountNamber(_accountService); validate.Validate(id, transferMoney.Sender); _accountService.TransferMoney(transferMoney.Sender, transferMoney.Recipient, transferMoney.sum); }
public void Executive_GivenValidAmount_UpdateAccounts() { var fromAccount = new AccountBuilder().WithBalance(0.01m).Build(); var toAccount = new AccountBuilder().WithBalance(0m).Build(); var amount = 0.01m; var mockRepository = new Mock <IAccountRepository>(); mockRepository .Setup(repo => repo.GetAccountById(fromAccount.Id)) .Returns(fromAccount); mockRepository .Setup(repo => repo.GetAccountById(toAccount.Id)) .Returns(toAccount); var sut = new TransferMoney(mockRepository.Object); sut.Execute(fromAccount.Id, toAccount.Id, amount); mockRepository.Verify(repo => repo.Update(It.Is <Account>(account => account.Id == fromAccount.Id && account.Balance == 0m))); mockRepository.Verify(repo => repo.Update(It.Is <Account>(account => account.Id == toAccount.Id && account.Balance == 0.01m))); }
public void Execute_ShouldThrowPayInLimitReachedException() { // Arrange decimal amount = 500m; var sender = new Account(); var receiver = new Account(); sender.Balance = 1500m; receiver.PaidIn = 3501m; // Since that the limit is 4000 and we send 500 it should throw the exception. // So, if the value of PaidIn changes to 3500 or less this test will fail. var mockAccountRepository = new Mock <IAccountRepository>(); var mockNotificationService = new Mock <INotificationService>(); var senderID = Guid.NewGuid(); var receiverID = Guid.NewGuid(); sender.User = new User { Email = "*****@*****.**", Id = senderID }; receiver.User = new User { Email = "*****@*****.**", Id = receiverID }; var transferMoney = new TransferMoney(mockAccountRepository.Object, mockNotificationService.Object); mockAccountRepository.Setup(x => x.GetAccountById(It.Is <Guid>(y => y == senderID))).Returns(sender); mockAccountRepository.Setup(x => x.GetAccountById(It.Is <Guid>(y => y == receiverID))).Returns(receiver); // Act & Assert Assert.Throws <InvalidOperationException>(() => transferMoney.Execute(senderID, receiverID, amount)); }
public async Task <TransferMoney> Delete(TransferMoney transferMoney) { try { _transferMoneys.Attach(transferMoney); if (transferMoney.Document != null) { foreach (var transaction in transferMoney.Document.Transactions.ToList()) { _transactions.Remove(transaction); } _documents.Remove(transferMoney.Document); } _transferMoneys.Remove(transferMoney); return(transferMoney); } catch (Exception ex) { return(null); } }
public void Setup() { _mockAccountRepository = new Mock <IAccountRepository>(); _mockNotificationService = new Mock <INotificationService>(); _testTransferMoney = new TransferMoney(_mockAccountRepository.Object, _mockNotificationService.Object); _testWithdrawMoney = new WithdrawMoney(_mockAccountRepository.Object, _mockNotificationService.Object); }
public void Execute_OperationIsSuccessful_ToAccountCorrectlyUpdated() { Account fromAccount = new Account() { Balance = 1000m, Id = Guid.NewGuid() }; Account toAccount = new Account() { Balance = 1000m, PaidIn = 200m, Id = Guid.NewGuid() }; var repositoryMock = TestHelpers.CreateRepositoryMock(new[] { fromAccount, toAccount }); var transferMoneyService = new TransferMoney(repositoryMock.Object); transferMoneyService.Execute(fromAccount.Id, toAccount.Id, 20m); repositoryMock.Verify(r => r.Update( It.Is <Account>(a => a.Id == toAccount.Id && a.Balance == 1020m && a.PaidIn == 220m)), Times.Once); }
public void TransferMoney_Given_From_account_balance_is_less_than_500m_after_withdrawal_fire_a_notification_NotifyFundsLow() { var fromAccountGuid = new System.Guid("adc1c2b0-bb71-4205-bf95-91bdbda67d75"); var toAccountId = new System.Guid("065a008a-e33e-4576-8f62-fd1f306e3202"); var user = new User() { Email = "*****@*****.**" }; var fromAccount = new Account() { Balance = 1000m, User = user }; var toAccount = new Account(); var accountRepoMock = new Mock <IAccountRepository>(); var notificationServiceMock = new Mock <INotificationService>(); accountRepoMock.Setup(xx => xx.GetAccountById(fromAccountGuid)).Returns(fromAccount); accountRepoMock.Setup(xx => xx.GetAccountById(toAccountId)).Returns(toAccount); var sut = new TransferMoney(accountRepoMock.Object, notificationServiceMock.Object); sut.Execute(fromAccountGuid, toAccountId, 600.0m); Assert.AreEqual(400m, fromAccount.Balance); notificationServiceMock.Verify(x => x.NotifyFundsLow(fromAccount.User.Email), Times.Once); }
public void TransferMoney_WhenPaidInLimitReached_throwsException_DoesNotCallUpdate() { var fromId = Guid.NewGuid(); var toId = Guid.NewGuid(); var accountRepository = new Mock <IAccountRepository>(); var notificationServiceWrapper = new Mock <INotificationServiceWrapper>(); var fromAcccount = new Account { Balance = 500 }; var toAccount = new Account { PaidIn = Account.PayInLimit }; accountRepository.Setup(x => x.GetAccountById(It.Is <Guid>(g => g == fromId))).Returns(fromAcccount); accountRepository.Setup(x => x.GetAccountById(It.Is <Guid>(g => g == toId))).Returns(toAccount); accountRepository.Setup(x => x.Update(fromAcccount)); accountRepository.Setup(x => x.Update(toAccount)); var sut = new TransferMoney(accountRepository.Object, notificationServiceWrapper.Object); Assert.Throws <InvalidOperationException>(() => sut.Execute(fromId, toId, 100m)); accountRepository.Verify(x => x.Update(fromAcccount), Times.Never); accountRepository.Verify(x => x.Update(toAccount), Times.Never); }
public void SetUp() { from = new Account() { Id = fromAccountId, Balance = 6000, User = new User { Email = FromUserEmail } }; to = new Account() { Id = toAccountId, Balance = 2000, User = new User { Email = ToUserEmail } }; _accountRepository = new Mock <IAccountRepository>(); _accountRepository.Setup(a => a.GetAccountById(fromAccountId)).Returns(from); _accountRepository.Setup(a => a.GetAccountById(toAccountId)).Returns(to); _notificationService = new Mock <INotificationService>(); _transferMoney = new TransferMoney(_accountRepository.Object, _notificationService.Object); }
public void Execute_WithdrawDeposit_FromAccountUpdated() { var fromAccount = new Account() { Id = Guid.NewGuid(), Balance = 1000m }; var toAccount = new Account() { Id = Guid.NewGuid(), Balance = 0m }; var mock = MockingHelper.GetAccountRepositoryMock( new List <Account>() { fromAccount, toAccount }); var transfer = new TransferMoney(mock.Object); transfer.Execute(fromAccount.Id, toAccount.Id, 100); mock.Verify(m => m.Update(It.Is <Account>(a => a.Id.Equals(fromAccount.Id) && a.Balance == 900m)), Times.AtLeastOnce); }
public void TransferMoneyCallsUpdate() { var fromId = Guid.NewGuid(); var toId = Guid.NewGuid(); var accountRepository = new Mock <IAccountRepository>(); var notificationServiceWrapper = new Mock <INotificationServiceWrapper>(); var fromAcccount = new Account { Balance = 500m }; var toAccount = new Account(); accountRepository.Setup(x => x.GetAccountById(It.Is <Guid>(g => g == fromId))).Returns(fromAcccount); accountRepository.Setup(x => x.GetAccountById(It.Is <Guid>(g => g == toId))).Returns(toAccount); accountRepository.Setup(x => x.Update(fromAcccount)); accountRepository.Setup(x => x.Update(toAccount)); var sut = new TransferMoney(accountRepository.Object, notificationServiceWrapper.Object); sut.Execute(fromId, toId, 100m); accountRepository.Verify(x => x.Update(fromAcccount)); accountRepository.Verify(x => x.Update(toAccount)); }
public TransferMoneyTests() { this.accountRepositoryMock = new Mock <IAccountRepository>(); this.notificationServiceMock = new Mock <INotificationService>(); transferMoneyFeature = new TransferMoney(accountRepositoryMock.Object, notificationServiceMock.Object); }
public void ShouldSendNotificationAboutApproachingWhenLessThan500LeftToPayInLimit() { // Arrange var user = new User(Guid.NewGuid(), "Name", "email"); var fromAccount = new Account(Guid.NewGuid(), null, 1000m, 0m, 0m); var toAccount = new Account(Guid.NewGuid(), user, 100m, 0m, 3450m); var accountRepositoryMock = new Mock <IAccountRepository>(); accountRepositoryMock .Setup(x => x.GetAccountById(fromAccount.Id)) .Returns(fromAccount); accountRepositoryMock .Setup(x => x.GetAccountById(toAccount.Id)) .Returns(toAccount); var notificationServiceMock = new Mock <INotificationService>(); var transferMoneyFeature = new TransferMoney(accountRepositoryMock.Object, notificationServiceMock.Object); // Act transferMoneyFeature.Execute(fromAccount.Id, toAccount.Id, 250m); // Assert notificationServiceMock.Verify(x => x.NotifyApproachingPayInLimit(user.Email)); }
public void TransfersMoneyWhenFromAccountHaveSufficientFundsAndToAccountDidntReachPayInLimit() { // Arrange var fromAccount = new Account(Guid.NewGuid(), null, 1000m, 0m, 0m); var toAccount = new Account(Guid.NewGuid(), null, 100m, 0m, 0m); var accountRepositoryMock = new Mock <IAccountRepository>(); accountRepositoryMock .Setup(x => x.GetAccountById(fromAccount.Id)) .Returns(fromAccount); accountRepositoryMock .Setup(x => x.GetAccountById(toAccount.Id)) .Returns(toAccount); var notificationServiceMock = new Mock <INotificationService>(); var transferMoneyFeature = new TransferMoney(accountRepositoryMock.Object, notificationServiceMock.Object); // Act transferMoneyFeature.Execute(fromAccount.Id, toAccount.Id, 250m); // Assert Assert.AreEqual(750m, fromAccount.Balance); Assert.AreEqual(350m, toAccount.Balance); }
public void Transfer_Execute_Success(decimal startBalanceFrom, decimal startBalanceTo, decimal paidInTo, decimal amountToTransfer, bool hasNotificationFrom, bool hasNotificationTo) { var emailAddressFrom = "*****@*****.**"; var emailAddressTo = "*****@*****.**"; //Arrange accountRepositoryMock.Setup(x => x.GetAccountById(FromAccountGuid)).Returns(new Account ( id: FromAccountGuid, balance: startBalanceFrom, user: new User( email: emailAddressFrom ) )); accountRepositoryMock.Setup(x => x.GetAccountById(ToAccountGuid)).Returns(new Account( id: ToAccountGuid, balance: startBalanceTo, paidIn: paidInTo, user: new User( email: emailAddressTo ) )); var transferMoney = new TransferMoney(accountRepositoryMock.Object, notificationServiceMock.Object); //Act transferMoney.Execute(FromAccountGuid, ToAccountGuid, amountToTransfer); //Assert accountRepositoryMock.Verify(x => x.Update(It.IsAny <Account>()), Times.Exactly(2)); notificationServiceMock.Verify(x => x.NotifyFundsLow(emailAddressFrom), Times.Exactly(hasNotificationFrom ? 1 : 0)); notificationServiceMock.Verify(x => x.NotifyApproachingPayInLimit(emailAddressTo), Times.Exactly(hasNotificationTo ? 1 : 0)); }
public void Transfer_should_fail_when_not_enough_balance() { var client1 = new Client(Guid.NewGuid(), "John", "Doe"); var client2 = new Client(Guid.NewGuid(), "Jane", "Doe"); var bank = Sys.ActorOf(Akka.Actor.Props.Create(() => new BankActor()), "bank"); bank.Tell(new CreateAccount(client1)); var resultClient1 = ExpectMsg<CreateAccountResult>(); bank.Tell(new CreateAccount(client2)); var resultClient2 = ExpectMsg<CreateAccountResult>(); var accountClient1 = Sys.ActorSelection("/user/bank/" + resultClient1.Account.Id); var accountClient2 = Sys.ActorSelection("/user/bank/" + resultClient2.Account.Id); accountClient1.Tell(new Deposit(50m)); accountClient2.Tell(new Deposit(50m)); ExpectMsg<Result<Deposit>>(); ExpectMsg<Result<Deposit>>(); var transferActor = Sys.ActorOf(Akka.Actor.Props.Create(() => new TransferActor())); var transfer = new TransferMoney(60m, resultClient1.Account, resultClient2.Account); transferActor.Tell(transfer); var transferResult = ExpectMsg<Result<TransferMoney>>(); Assert.Equal(MoneyTransactions.Status.Error, transferResult.Status); accountClient1.Tell(new CheckBalance()); ExpectMsg<BalanceStatus>(msg => Assert.Equal(50m, msg.Balance)); accountClient2.Tell(new CheckBalance()); ExpectMsg<BalanceStatus>(msg => Assert.Equal(50m, msg.Balance)); }
public void Transfer_Execute_NotSufficientFunds(decimal startBalanceFrom, decimal startBalanceTo, decimal paidInTo, decimal amountToTransfer, bool hasNotificationFrom, bool hasNotificationTo) { var emailAddressFrom = "*****@*****.**"; var emailAddressTo = "*****@*****.**"; //Arrange accountRepositoryMock.Setup(x => x.GetAccountById(FromAccountGuid)).Returns(new Account( id: FromAccountGuid, balance: startBalanceFrom, user: new User( email: emailAddressFrom ) )); accountRepositoryMock.Setup(x => x.GetAccountById(ToAccountGuid)).Returns(new Account( id: ToAccountGuid, balance: startBalanceTo, paidIn: paidInTo, user: new User( email: emailAddressTo ) )); var transferMoney = new TransferMoney(accountRepositoryMock.Object, notificationServiceMock.Object); //Act void testDelegate() => transferMoney.Execute(FromAccountGuid, ToAccountGuid, amountToTransfer); //Assert Assert.That(testDelegate, Throws.TypeOf <InvalidOperationException>()); accountRepositoryMock.Verify(x => x.Update(It.IsAny <Account>()), Times.Never()); notificationServiceMock.Verify(x => x.NotifyFundsLow(emailAddressFrom), Times.Never()); notificationServiceMock.Verify(x => x.NotifyApproachingPayInLimit(emailAddressTo), Times.Never()); }
public void TestInit() { fromAccount = new Account { Id = System.Guid.NewGuid(), User = new User { Name = "Chris", Id = System.Guid.NewGuid() }, Balance = 2000m, Withdrawn = 0m, PaidIn = 2000m }; toAccount = new Account { Id = System.Guid.NewGuid(), User = new User { Name = "Jen", Id = System.Guid.NewGuid() }, Balance = 3000m, Withdrawn = 0m, PaidIn = 3000m }; accountRepository = new AccountRepository(); accountRepository.Update(fromAccount); accountRepository.Update(toAccount); accountNotificationService = new AccountNotificationService(); transferMoney = new TransferMoney(accountRepository, accountNotificationService); }
public void TransferMoney_Given_From_account_has_enough_money_and_to_account_has_0_will_remove_amount_withdrawn_from_fromAccountBalance_and_add_it_toToAccountBalance() { var fromAccountGuid = new System.Guid("adc1c2b0-bb71-4205-bf95-91bdbda67d75"); var toAccountId = new System.Guid("065a008a-e33e-4576-8f62-fd1f306e3202"); var toAccount = new Account(); var fromAccount = new Account() { Balance = 1000m, }; var accountRepoMock = new Mock <IAccountRepository>(); var notificationServiceMock = new Mock <INotificationService>(); accountRepoMock.Setup(xx => xx.GetAccountById(fromAccountGuid)).Returns(fromAccount); accountRepoMock.Setup(xx => xx.GetAccountById(toAccountId)).Returns(toAccount); var sut = new TransferMoney(accountRepoMock.Object, notificationServiceMock.Object); sut.Execute(fromAccountGuid, toAccountId, 100.0m); Assert.AreEqual(900m, fromAccount.Balance); Assert.AreEqual(100m, toAccount.Balance); }
public void TransferMoney_SufficientFunds_UnderPayInLimit() { var fromAccountId = Guid.NewGuid(); var toAccountId = Guid.NewGuid(); var user = new User { Id = Guid.NewGuid(), Name = "User", Email = "" }; var fromAccount = new Account { Id = fromAccountId, Balance = 100, User = user }; var toAccount = new Account { Id = toAccountId, Balance = 0, User = user }; IAccountRepository accounts = new MockAccountRepository(); accounts.Add(fromAccount); accounts.Add(toAccount); var notificationService = new MockNotificationService(); TransferMoney transferMoneyFeature = new TransferMoney(accounts, notificationService); transferMoneyFeature.Execute(fromAccountId, toAccountId, 100); fromAccount = accounts.GetAccountById(fromAccountId); toAccount = accounts.GetAccountById(toAccountId); Assert.AreEqual(0, fromAccount.Balance); Assert.AreEqual(-100, fromAccount.Withdrawn); Assert.AreEqual(100, toAccount.Balance); Assert.AreEqual(100, toAccount.PaidIn); }
public void TransferMoney_ensure_withdrawn_is_updated_with_correct_amount() { var fromAccountGuid = new System.Guid("adc1c2b0-bb71-4205-bf95-91bdbda67d75"); var toAccountId = new System.Guid("065a008a-e33e-4576-8f62-fd1f306e3202"); var user = new User() { Email = "*****@*****.**" }; var fromAccount = new Account() { Balance = 1000m, User = user }; var toAccount = new Account(); var accountRepoMock = new Mock <IAccountRepository>(); var notificationServiceMock = new Mock <INotificationService>(); accountRepoMock.Setup(xx => xx.GetAccountById(fromAccountGuid)).Returns(fromAccount); accountRepoMock.Setup(xx => xx.GetAccountById(toAccountId)).Returns(toAccount); var sut = new TransferMoney(accountRepoMock.Object, notificationServiceMock.Object); sut.Execute(fromAccountGuid, toAccountId, 600.0m); Assert.AreEqual(-600m, fromAccount.Withdrawn); }
public void TestPayinLimitTransfer() { this.testToAccount = new Account( id: Guid.NewGuid(), user: testToUser, balance: 100.0m, paidIn: Account.PayInLimit, withdrawn: 50m); this.accountRepository.Setup(x => x.GetAccountById(this.testToAccount.Id)).Returns(() => this.testToAccount); decimal startFromBalance = this.testFromAccount.Balance; TransferMoney transferMoneyFeature = new TransferMoney(accountRepository.Object, notificationService.Object); try { transferMoneyFeature.Execute(this.testFromAccount.Id, this.testToAccount.Id, 10.0m); } catch (InvalidOperationException e) { StringAssert.Contains(e.Message, "Account pay in limit reached"); return; } Assert.Fail("No exception was thrown."); }
public void Transfernotavailablefunds() { Exception expectedException = null; Account orgin = new Account() { Availablefunds = 0 }; Account destination = new Account() { Availablefunds = 0 }; decimal amountTransfer = 5m; var mock = new Mock <IValidateTransfer>(); string error = "There are not available funds"; mock.Setup(x => x.TransferValidation(orgin, amountTransfer)).Returns(error); var service = new TransferMoney(mock.Object); try { service.Transfer(orgin, destination, amountTransfer); Assert.Fail("Error"); } catch (Exception ex) { expectedException = ex; } Assert.IsTrue(expectedException is ApplicationException); Assert.AreEqual(error, expectedException.Message); }
public void TestIntsufficentFundsTransfer() { this.testFromAccount = new Account( id: Guid.NewGuid(), user: testFromUser, balance: 5.0m, paidIn: 200m, withdrawn: 50m); this.accountRepository.Setup(x => x.GetAccountById(this.testFromAccount.Id)).Returns(() => this.testFromAccount); decimal startFromBalance = this.testFromAccount.Balance; TransferMoney transferMoneyFeature = new TransferMoney(accountRepository.Object, notificationService.Object); try { transferMoneyFeature.Execute(this.testFromAccount.Id, this.testToAccount.Id, 10.0m); } catch (InvalidOperationException e) { StringAssert.Contains(e.Message, "Insufficient funds to complete action"); return; } Assert.Fail("No exception was thrown."); }
public void TransferMoney_Succesfully() { Guid from = Guid.NewGuid(); Guid to = Guid.NewGuid(); var fromAccount = new Domain.Account(from, new Domain.User(Guid.NewGuid(), "alice", "*****@*****.**"), 100m, 90m, 0m); var toAccount = new Domain.Account(to, new Domain.User(Guid.NewGuid(), "bob", "*****@*****.**"), 120m, 80m, 0m); Moq.Mock <IAccountRepository> moq = new Moq.Mock <IAccountRepository>(); moq.Setup(x => x.GetAccountById(from)).Returns(fromAccount); moq.Setup(x => x.GetAccountById(to)).Returns(toAccount); IAccountRepository repository = moq.Object; TransferMoney transferMoney = new TransferMoney(repository); bool result = transferMoney.Execute(from, to, 10); Assert.True(result); Assert.Equal(90m, fromAccount.Balance); Assert.Equal(130m, toAccount.Balance); moq.Verify(v => v.Update(fromAccount)); moq.Verify(v => v.Update(toAccount)); }
public void Execute_BalanceIsLessThanAmountToWithdraw_ThrowInvalidOperationException() { _fromAccount.Balance = 1m; var sut = new TransferMoney(_accountRepository.Object, _notificationService.Object); Assert.Throws <InvalidOperationException>(() => sut.Execute(_fromAccountId, _toAccountId, 2m)); }
public void Execute_ShouldThrowInsufficientFundsException() { // Arrange decimal amount = 500m; var sender = new Account(); var receiver = new Account(); sender.Balance = 499m; // Since that the the exception would be thrown if the new balance is less than 0 and we send 500, // then if the value of sender's balance changes to 500 or more this test will fail. var mockAccountRepository = new Mock <IAccountRepository>(); var mockNotificationService = new Mock <INotificationService>(); var senderID = Guid.NewGuid(); var receiverID = Guid.NewGuid(); sender.User = new User { Email = "*****@*****.**", Id = senderID }; receiver.User = new User { Email = "*****@*****.**", Id = receiverID }; var transferMoney = new TransferMoney(mockAccountRepository.Object, mockNotificationService.Object); mockAccountRepository.Setup(x => x.GetAccountById(It.Is <Guid>(y => y == senderID))).Returns(sender); mockAccountRepository.Setup(x => x.GetAccountById(It.Is <Guid>(y => y == receiverID))).Returns(receiver); // Act & Assert Assert.Throws <InvalidOperationException>(() => transferMoney.Execute(senderID, receiverID, amount)); }
public void Execute_ExceedPayInLimit_ThrowInvalidOperationException() { _toAccount.Balance = PayInLimit; var sut = new TransferMoney(_accountRepository.Object, _notificationService.Object); Assert.Throws <InvalidOperationException>(() => sut.Execute(_fromAccountId, _toAccountId, 1m)); }
public void TransferMoney_Execute_SuccessfullTransfer(decimal balance, decimal transferAmount) { // Arrange var accountRepository = new AccountRepository(); var sourceAccount = new Account(_userA); sourceAccount.Deposit(balance); accountRepository.Update(sourceAccount); var destinationAccount = new Account(_userB); accountRepository.Update(destinationAccount); var notificationService = new NotificationService(); var transferMoneyFeature = new TransferMoney(accountRepository, notificationService); // Act transferMoneyFeature.Execute(sourceAccount.Id, destinationAccount.Id, transferAmount); // Assert Assert.Equal(0, accountRepository.GetAccountById(sourceAccount.Id).Balance); Assert.Equal(100, accountRepository.GetAccountById(destinationAccount.Id).Balance); Assert.Equal(100, accountRepository.GetAccountById(destinationAccount.Id).PaidIn); }
public TransferMoneyEntity GetTransferMoneyDetails(string cashChequeNo) { TransferMoneyEntity transferMoney = new TransferMoneyEntity(); try { using (SASEntitiesEDM entities = new SASEntitiesEDM()) { TransferMoney cbt = entities.TransferMoneys.SingleOrDefault(e => e.Cheque_No == cashChequeNo); if (cbt != null) { transferMoney.ID = cbt.ID; transferMoney.SelectedtransferFromCashAndBankAcntID = cbt.From_Acc_Id; transferMoney.SelectedtransferToCashBankAcntID = cbt.To_Acc_Id; transferMoney.IsCheque = cbt.Cheque; transferMoney.CashChequeNo = cbt.Cheque_No; transferMoney.CashChequeDate = cbt.Cheque_Date; transferMoney.Remarks = cbt.Remarks; transferMoney.Amount = cbt.Amount; transferMoney.Remarks = cbt.Remarks; } } } catch (Exception ex) { throw ex; } return(transferMoney); }