Exemplo n.º 1
0
        public void Charge_overdaft_fees()
        {
            SavingBookContract saving = new SavingBookContract(ApplicationSettings.GetInstance(""),
                                                               new User(), new DateTime(2009, 01, 01), null)
                                            {
                                                Product = _bookProduct,
                                                AgioFees = 0.01,
                                                ChequeDepositFees = 100,
                                                DepositFees = 50,
                                                CloseFees = 100,
                                                ReopenFees = 100,
                                                OverdraftFees = 100
                                            };
            saving.FirstDeposit(1000, new DateTime(2009, 01, 01), null, new User(), Teller.CurrentTeller);

            Currency currency = new Currency() { UseCents = true, Code = "SOM", Id = 1, IsPivot = true, Name = "SOM" };

            Assert.AreEqual(1000, saving.GetBalance().Value);

            //Below, we explicitly implement withdraw method from <Saving services>.<Withdraw>, since withdraw method of 'saving' object doesn't implement
            // overdraft fee by default

            List<SavingEvent> withdrawEvents = saving.Withdraw(1100, new DateTime(2009, 1, 2), "withdraw", new User(), false, null);
            if (saving.GetBalance() < 0 && !saving.InOverdraft)
            {
                saving.ChargeOverdraftFee(new DateTime(2009, 1, 2), new User());
            }

            Assert.AreEqual(-200, saving.GetBalance().Value);
        }