예제 #1
0
        public void CloseSaving()
        {
            SavingBookContract saving = new SavingBookContract(ApplicationSettings.GetInstance(""),
                                                               new User()
            {
                Id = 1
            }, new DateTime(2009, 01, 01), _savingsBookProduct, null)
            {
                Code             = "S/CR/2009/SAVIN-1/BAR-1",
                Status           = OSavingsStatus.Active,
                InterestRate     = 0.01,
                FlatWithdrawFees = 3
            };

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

            User user = new User {
                Id = 1
            };

            saving.Events[0].User = user;
            saving.SavingsOfficer = user;
            saving.Id             = _savingManager.Add(saving, new Person()
            {
                Id = 6
            });

            saving.Status     = OSavingsStatus.Closed;
            saving.ClosedDate = new DateTime(2009, 10, 01);
            _savingManager.UpdateStatus(saving.Id, saving.Status, saving.ClosedDate.Value);

            SavingBookContract retrievedSaving = (SavingBookContract)_savingManager.Select(saving.Id);

            Assert.AreEqual(OSavingsStatus.Closed, retrievedSaving.Status);
            Assert.AreEqual(new DateTime(2009, 10, 01), retrievedSaving.ClosedDate.Value);
        }