public void TestTransactionList() { var cacheLogic = new CacheLogic(); cacheLogic.ClearCache(); var registerLogic = new RegistrationLogic(); registerLogic.RegisterNewUser("alex", "pass"); WithdrawlLogic withdrawlLogic = new WithdrawlLogic(); var firstWithdrawl = withdrawlLogic.CreateWithdrawl("Customer1", "Check", 22, "alex"); withdrawlLogic.CreateWithdrawl("Customer1", "Check", 2, "alex"); DepositLogic depositLogic = new DepositLogic(); var firstDeposit = depositLogic.CreateDeposit("Customer1", "Check", 55, "alex"); TransactionLogic transactionLogic = new TransactionLogic(); var transactionList = transactionLogic.GetTransactionList("alex"); Assert.AreEqual(transactionList.Count, 3); Assert.AreEqual((-transactionList[1].Amount), firstWithdrawl.Amount); Assert.AreEqual((transactionList[0].Amount), firstDeposit.Amount); }
public void TestGetBalance() { var cacheLogic = new CacheLogic(); cacheLogic.ClearCache(); var registerLogic = new RegistrationLogic(); registerLogic.RegisterNewUser("alex", "pass"); WithdrawlLogic withdrawlLogic = new WithdrawlLogic(); withdrawlLogic.CreateWithdrawl("Customer1", "Check", 22, "alex"); withdrawlLogic.CreateWithdrawl("Customer1", "Check", 2, "alex"); DepositLogic depositLogic = new DepositLogic(); depositLogic.CreateDeposit("Customer1", "Check", 55, "alex"); TransactionLogic transactionLogic = new TransactionLogic(); var currentBalance = transactionLogic.GetBalance("alex"); Assert.AreEqual((55 - 22 - 2), currentBalance); }
public HttpResponseMessage DepositForStudents(List <DepositDTO> deposits) { foreach (var item in deposits) { DepositLogic.NewDeposit(item); } return(Request.CreateResponse(HttpStatusCode.OK)); }
public HttpResponseMessage GetDeposits() { List <DepositDTO> deposits = new List <DepositDTO>(); deposits = DepositLogic.GetDeposits(); if (deposits != null) { return(Request.CreateResponse(HttpStatusCode.OK, deposits)); } else { return(Request.CreateResponse(HttpStatusCode.NotFound)); } }
public HttpResponseMessage DeleteDeposit(DepositDTO depositDTO) { DepositLogic.deleteDeposit(depositDTO); return(Request.CreateResponse(HttpStatusCode.OK)); }
public HttpResponseMessage NewDeposit(DepositDTO deposit) { return(Request.CreateResponse(HttpStatusCode.OK, DepositLogic.NewDeposit(deposit))); }