Exemplo n.º 1
0
        public CreateLoanResult CreateLoan(LoanData data)
        {
            Logger.LogLine($"Processing loan request for user {data.PhoneNumber}");

            if (validatorManager.ValidateLoan(data.PhoneNumber, data.Amount, data.Days))
            {
                Logger.LogLine($"Cannot create loan, validation failed.");
                return(CreateLoanResult.Failed());
            }

            saveUserManager.SaveUser(new User(data.PhoneNumber));

            if (riskManager.CheckForBadPhones(data.PhoneNumber))
            {
                Logger.LogLine($"Cannot create loan, user phone is in BadPhone Collection");
                return(CreateLoanResult.Failed());
            }

            return(CreateLoanResult.Success(calculatorManager.CalculateLoan(data.Amount, data.Days)));
        }
Exemplo n.º 2
0
        public void CalculatirManager()
        {
            var calculatorManager = new CalculatorManager();

            Assert.AreEqual(calculatorManager.CalculateLoan(200, 10), 260.92);
        }