public void CloseAccount_InvalidParams_ArgumentException() { IBankService service = GetKernel(); service.NewAccount(1, 1000m, 1); List <AccountBll> storage = service.AllAccount().ToList(); AccountBll temp = storage.Find(item => item.PersoneId == 1); Assert.Throws <ArgumentException>(() => service.CloseAccount(temp)); }
public void CloseAccount_ValidParams_ValidResult() { IBankService service = GetKernel(); service.NewAccount(1, 1000m, 1); List <AccountBll> storage = service.AllAccount().ToList(); AccountBll temp = storage.Find(item => item.PersoneId == 1); service.Withdrawal(1000m, temp); service.CloseAccount(temp); Assert.AreEqual(false, temp.Valid); }
public ActionResult Change(AccountViewModel model, string action) { if (action == "minus") { _service.WriteAmount(model.Id, model.Summ); } else if (action == "plus") { _service.ReplenishAmount(model.Id, model.Summ); } else { _service.CloseAccount(model.Id); } return(RedirectToAction("Index")); }