示例#1
0
        public void Withdrawal_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.Withdrawal(2000m, temp));
        }
示例#2
0
        public void Withdrawal_ValidValue_ValidResult()
        {
            IBankService service = GetKernel();

            service.NewAccount(1, 2000m, 1);
            List <AccountBll> storage = service.AllAccount().ToList();
            AccountBll        temp    = storage.Find(item => item.PersoneId == 1);

            service.Withdrawal(1000m, temp);
            Assert.AreEqual(1000m, temp.Balance);
        }
示例#3
0
        public void Transfer_InvalidParams_ArgumentException()
        {
            IBankService service = GetKernel();

            service.NewAccount(2, 2000m, 1);
            service.NewAccount(1, 1000m, 1);
            List <AccountBll> storage       = service.AllAccount().ToList();
            AccountBll        firstPersone  = storage.Find(item => item.PersoneId == 1);
            AccountBll        secondPersone = storage.Find(item => item.PersoneId == 2);

            Assert.Throws <ArgumentException>(() => service.Transfer(secondPersone, firstPersone, 3000m));
        }
示例#4
0
        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);
        }
示例#5
0
        public void Transfer_ValidValue_ValidResult()
        {
            IBankService service = GetKernel();

            service.NewAccount(2, 2000m, 1);
            service.NewAccount(1, 1000m, 1);
            List <AccountBll> storage       = service.AllAccount().ToList();
            AccountBll        firstPersone  = storage.Find(item => item.PersoneId == 1);
            AccountBll        secondPersone = storage.Find(item => item.PersoneId == 2);

            service.Transfer(secondPersone, firstPersone, 500m);
            Assert.AreEqual(1500m, firstPersone.Balance);
        }