Пример #1
0
        public void TestDepositEvent()
        {
            List <SavingEvent> savingEventList = _saving.Deposit(100, TimeProvider.Today, "testDepot", _user, false, false, OSavingsMethods.Cash, new PaymentMethod(), null, null);

            foreach (SavingEvent savingEvent in savingEventList)
            {
                savingEvent.Id = _savingEventManager.Add(savingEvent, _saving.Id);
                SavingEvent retrievedSavingEvent = _savingEventManager.SelectEvents(_saving.Id, _saving.Product).Find(item => item.Id == savingEvent.Id);
                CompareEvent(savingEvent, retrievedSavingEvent);
            }
        }
Пример #2
0
        public void CalculateInterest_OneMonth()
        {
            SavingsBookProduct product = new SavingsBookProduct
            {
                Id                = 1,
                InterestBase      = OSavingInterestBase.Weekly,
                InterestFrequency = OSavingInterestFrequency.EndOfYear,
                CalculAmountBase  = OSavingCalculAmountBase.MinimalAmount
            };
            SavingBookContract saving = new SavingBookContract(ApplicationSettings.GetInstance(""), new User(),
                                                               new DateTime(2009, 01, 01), null)
            {
                Product = product, InterestRate = 0.1
            };

            saving.FirstDeposit(1000, new DateTime(2009, 01, 01), null, new User(), Teller.CurrentTeller);

//            saving.Deposit(100, new DateTime(2009, 02, 01), "depot", new User(), true, false, OPaymentMethods.Cash, null, null);
            saving.Deposit(100, new DateTime(2009, 02, 01), "depot", new User(), true, false, OSavingsMethods.Cash, null, null);

            List <SavingInterestsAccrualEvent> list = new List <SavingInterestsAccrualEvent>();

            list = saving.CalculateInterest(new DateTime(2009, 02, 01), new User {
                Id = 1
            });

            Assert.AreEqual(list.Count, 4);
            Assert.AreEqual(list[0].Amount, 100);
        }
Пример #3
0
        public void CalculateInterest_TwoOperation_In_OneDay()
        {
            SavingsBookProduct product = new SavingsBookProduct
            {
                Id                = 1,
                InterestBase      = OSavingInterestBase.Weekly,
                InterestFrequency = OSavingInterestFrequency.EndOfYear,
                CalculAmountBase  = OSavingCalculAmountBase.MinimalAmount,
                WithdrawFeesType  = OSavingsFeesType.Flat,
                FlatWithdrawFees  = 0
            };
            SavingBookContract saving = new SavingBookContract(ApplicationSettings.GetInstance(""), new User(),
                                                               new DateTime(2009, 01, 01), null)
            {
                Product = product, InterestRate = 0.1, FlatWithdrawFees = 0
            };

            saving.FirstDeposit(1000, new DateTime(2009, 01, 01), null, new User(), Teller.CurrentTeller);

            saving.Withdraw(250, new DateTime(2009, 01, 02), "retrait", new User(), false, null, new PaymentMethod());
//            saving.Deposit(100, new DateTime(2009, 02, 01), "depot", new User(), true, false, OPaymentMethods.Cash, null, null);
            saving.Deposit(100, new DateTime(2009, 02, 01), "depot", new User(), true, false, OSavingsMethods.Cash, new PaymentMethod(), null, null);

            List <SavingInterestsAccrualEvent> list = new List <SavingInterestsAccrualEvent>();

            list = saving.CalculateInterest(new DateTime(2009, 01, 08), new User {
                Id = 1
            });

            Assert.AreEqual(list.Count, 1);
            Assert.AreEqual(list[0].Amount, 75);
        }
Пример #4
0
        public void Charge_deposit_fees()
        {
            SavingBookContract saving = new SavingBookContract(ApplicationSettings.GetInstance(""),
                                                               new User(), new DateTime(2009, 1, 1), null)
            {
                Product           = _bookProduct,
                AgioFees          = 0.01,
                ChequeDepositFees = 100,
                DepositFees       = 50,
                CloseFees         = 100,
                ReopenFees        = 100,
                OverdraftFees     = 100
            };
            Currency currency = new Currency()
            {
                UseCents = true, Code = "SOM", Id = 1, IsPivot = true, Name = "SOM"
            };

//            List<SavingEvent> cashDepositEvents = saving.Deposit(100, new DateTime(2009, 1, 2), "cash deposit", new User(), false,
//                                                             false, OPaymentMethods.Cash, null, null);
            List <SavingEvent> cashDepositEvents = saving.Deposit(100, new DateTime(2009, 1, 2), "cash deposit", new User(), false,
                                                                  false, OSavingsMethods.Cash, null, null);
//            List<SavingEvent> chequeDepositEvents = saving.Deposit(100, new DateTime(2009, 1, 2), "cheque deposit", new User(), false,
//                                                             false, OPaymentMethods.Cheque, null, null);
            List <SavingEvent> chequeDepositEvents = saving.Deposit(100, new DateTime(2009, 1, 2), "cheque deposit", new User(), false,
                                                                    false, OSavingsMethods.Cheque, null, null);

            foreach (SavingEvent cashEvent in cashDepositEvents)
            {
                Assert.AreEqual(cashEvent.Fee, saving.DepositFees);
            }
            foreach (SavingEvent chequeEvent in chequeDepositEvents)
            {
                Assert.AreEqual(chequeEvent.Fee, saving.ChequeDepositFees);
            }
        }
Пример #5
0
        public void CalculateInterest_AccrualhMode_Daily_EndOfYear_OneClosure_AfterOneWeek_Agio()
        {
            Assert.Ignore();
            ApplicationSettings.GetInstance("").UpdateParameter(OGeneralSettings.ACCOUNTINGPROCESS, OAccountingProcesses.Accrual);
            _bookProduct.InterestFrequency = OSavingInterestFrequency.EndOfYear;
            SavingBookContract saving = new SavingBookContract(ApplicationSettings.GetInstance(""), new User(),
                                                               new DateTime(2009, 01, 01), null)
            {
                Product = _bookProduct, InterestRate = 0.1, AgioFees = 0.1
            };

            saving.Closure(new DateTime(2009, 01, 08), new User()
            {
                Id = 1
            });

            int accrualEvents = saving.Events.FindAll(item => item is SavingInterestsAccrualEvent).Count;
            int postingEvents = saving.Events.FindAll(items => items is SavingInterestsPostingEvent).Count;

            List <SavingEvent> agioEvents = saving.Events.FindAll(items => items is SavingAgioEvent);

            Assert.AreEqual(agioEvents.Count, 7);
            Assert.AreEqual(agioEvents[0].Fee, 10);
            Assert.AreEqual(saving.GetBalance(), -170);

//            saving.Deposit(200, new DateTime(2009, 01, 08), "depot", new User(), false, false, OPaymentMethods.Cash, null, null);
            saving.Deposit(200, new DateTime(2009, 01, 08), "depot", new User(), false, false, OSavingsMethods.Cash, null, null);
            //saving.Withdraw(230, new DateTime(2009, 02, 03), "retrait", new User(), false);

            saving.Closure(new DateTime(2009, 01, 15), new User()
            {
                Id = 1
            });
            List <SavingEvent> agioEvents2 = saving.Events.FindAll(items => items is SavingAgioEvent);

            Assert.AreEqual(agioEvents2.Count, 13);
            Assert.AreEqual(agioEvents2[9].Fee, 13);
            Assert.AreEqual(saving.GetBalance(), -51);
        }