Пример #1
0
        public void CalculateInterest_OneMonth_Deposit()
        {
            SavingProduct product = new SavingProduct
            {
                Id                = 1,
                InterestBase      = OSavingInterestBase.Monthly,
                InterestFrequency = OSavingInterestFrequency.EndOfYear,
                CalculAmountBase  = OSavingCalculAmountBase.MinimalAmount
            };
            Saving saving = new Saving(ApplicationSettings.GetInstance(""), new User(),
                                       1000, new DateTime(2009, 01, 01))
            {
                Product = product, InterestRate = 0.1
            };

            saving.Deposit(100, new DateTime(2009, 01, 15), "depot", new User());

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

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

            Assert.AreEqual(list.Count, 1);
            Assert.AreEqual(list[0].Amount, 100);
        }
Пример #2
0
        public void AddSavingValue(Saving saving)
        {
            var savingValue = saving.Deposit(null, 0, DateTime.Now);

            using (var tx = Database.GetTransaction())
            {
                Database.Save(savingValue);
                tx.Complete();
            }
            LoadSavingsData();
        }
Пример #3
0
        public void CalculateInterest_OneMonth_Deposit_FirstDayOfMonth()
        {
            SavingProduct product = new SavingProduct
            {
                Id = 1,
                InterestBase = OSavingInterestBase.Monthly,
                InterestFrequency = OSavingInterestFrequency.EndOfYear,
                CalculAmountBase = OSavingCalculAmountBase.MinimalAmount
            };
            Saving saving = new Saving(ApplicationSettings.GetInstance(""), new User(),
                1000, new DateTime(2009, 01, 01)) { Product = product, InterestRate = 0.1 };

            saving.Deposit(100, new DateTime(2009, 01, 01), "depot", new User());

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

            Assert.AreEqual(list.Count, 1);
            Assert.AreEqual(list[0].Amount, 110);
        }