Exemple #1
0
        public Structure(ClientAccounts sourceClientAccounts, List <Allocation> allocations, InterestRates interestRates, PaymentInstructionService paymentInstructionService)
        {
            if (sourceClientAccounts.Count < 2)
            {
                throw new ArgumentException("A structure must have at least 2 source accounts.");
            }

            float totalPercentage = 0;

            allocations.ForEach(al => totalPercentage += al.GetAllocationPercentage());

            if (totalPercentage != 100)
            {
                throw new ArgumentException("A structure should have 100% allocation.");
            }

            if (allocations.Count != 1 && allocations.Exists(al => !sourceClientAccounts.Contains(al.GetAccount())))
            {
                throw new ArgumentException("All allocations should be in pooled account or there should be only one allocation account.");
            }

            this.sourceClientAccounts      = sourceClientAccounts;
            this.allocations               = allocations;
            this.interestRates             = interestRates;
            this.paymentInstructionService = paymentInstructionService;
        }
 public void Delete(InterestRates delObj)
 {
     using (var session = GetSession())
     {
         using (var trans = session.BeginTransaction())
         {
             session.Delete(delObj);
             trans.Commit();
         }
     }
 }
 public void Save(InterestRates saveObj)
 {
     using (var session = GetSession())
     {
         using (var trans = session.BeginTransaction())
         {
             session.FlushMode = FlushMode.Commit;
             session.SaveOrUpdate(saveObj);
             trans.Commit();
             session.Flush();
             //}
         }
     }
 }
        public ActionResult Index()
        {
            ViewBag.Message = "Apply today for our award winning personal loans.";

            // Hard-coded rates for demo purposes
            var rates = new InterestRates
            {
                CreditCardRate  = 22.33m,
                LoanRate        = 9.24m,
                TermDepositRate = 5.2m
            };

            return(View(rates));
        }
        public void ShouldRenderLoanInterestRate()
        {
            var sut = new Views.Home.Index();

            var model = new InterestRates
            {
                LoanRate = 23.45m
            };

            HtmlDocument html = sut.RenderAsHtml(model);

            var renderedLoanRate = html.GetElementbyId("loanRate").InnerText;

            Assert.That(renderedLoanRate, Is.EqualTo("23,45"));
        }