Example #1
0
 public void ShouldLoadInterestRates()
 {
     StringReader reader = new StringReader("PositiveInterestRate=2.0\nNegativeInterestRate=3.0");
     var configurationManager = new InterestRates(reader);
     Assert.AreEqual(0.0d, configurationManager.PositiveInterestRate());
     Assert.AreEqual(0.0d, configurationManager.NegativeInterestRate());
     configurationManager.Configure();
     Assert.AreEqual(2.0d, configurationManager.PositiveInterestRate());
     Assert.AreEqual(3.0d, configurationManager.NegativeInterestRate());
 }
Example #2
0
        public void ShouldLoadInterestRates()
        {
            StringReader reader = new StringReader("PositiveInterestRate=2.0\nNegativeInterestRate=3.0");
            var          configurationManager = new InterestRates(reader);

            Assert.AreEqual(0.0d, configurationManager.PositiveInterestRate());
            Assert.AreEqual(0.0d, configurationManager.NegativeInterestRate());
            configurationManager.Configure();
            Assert.AreEqual(2.0d, configurationManager.PositiveInterestRate());
            Assert.AreEqual(3.0d, configurationManager.NegativeInterestRate());
        }
Example #3
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;
        }
Example #4
0
        private static Structure GetTestStructure(double balance1, double balance2, List <Allocation> allocations, InterestRates interestRates, PaymentInstructionService paymentInstructionService)
        {
            var clientId = new ClientId("ABC123");
            var account1 = new Account(new AccountId(12341234), clientId);
            var account2 = new Account(new AccountId(12341235), clientId);

            account1.Balance = balance1;
            account2.Balance = balance2;

            var clientAccounts = new ClientAccounts();

            clientAccounts.Add(account1);
            clientAccounts.Add(account2);
            return(new Structure(clientAccounts, allocations, interestRates, paymentInstructionService));
        }
Example #5
0
        private static Structure GetTestStructure(double balance1, double balance2, List<Allocation> allocations, InterestRates interestRates, PaymentInstructionService paymentInstructionService)
        {
            var clientId = new ClientId("ABC123");
            var account1 = new Account(new AccountId(12341234), clientId);
            var account2 = new Account(new AccountId(12341235), clientId);
            account1.Balance = balance1;
            account2.Balance = balance2;

            var clientAccounts = new ClientAccounts();
            clientAccounts.Add(account1);
            clientAccounts.Add(account2);
            return new Structure(clientAccounts, allocations, interestRates, paymentInstructionService);
        }