public static void Main(string[] args)
        {
            if (args.Length < 2)
            {
                Console.WriteLine(UsageMessage);
                Environment.Exit(1);
            }
            int requestedAmount;

            int.TryParse(args[1], out requestedAmount);
            try
            {
                var stringFileName     = args[0];
                var lendRateCalculator = OptimalLendRateCalculatorFactory.GetOptimalLendRateCalculator(stringFileName, requestedAmount);
                var calculatedRate     = lendRateCalculator.GetOptimalLendRateInformation();
                Console.WriteLine(calculatedRate.ToString());
            }
            catch (InvalidLoanRequest ilr)
            {
                Console.WriteLine(ilr.Message);
            }
            catch (InsufficientFundsException isfe)
            {
                Console.WriteLine(isfe.Message);
            }
        }
        public void Test3_ValidRequestAmount_EqualToValue(int requestAmount)
        {
            var filePath = TestContext.CurrentContext.TestDirectory + @"\TestData\test_data_1.csv";

            Assert.DoesNotThrow(
                () => OptimalLendRateCalculatorFactory.GetOptimalLendRateCalculator(filePath, requestAmount),
                string.Format("Requested amount: {0} , should not throw an InvalidLoanRequest exception!", requestAmount));
        }
        public void Test1_CalculatLendRate()
        {
            var filePath                  = TestContext.CurrentContext.TestDirectory + @"\TestData\test_data_1.csv";
            var requestAmount             = 1100;
            var optimalLendRateCalculator = OptimalLendRateCalculatorFactory.GetOptimalLendRateCalculator(filePath, requestAmount);
            var oRate = optimalLendRateCalculator.GetOptimalLendRateInformation();

            Assert.IsNotNull(oRate);
            Assert.AreEqual(oRate.OptimumLendRate, oRate.OptimumLendRate);
        }
        public void Test4_CalculatedOptimalLendRate()
        {
            var requestAmount = 1100;
            var filePath      = TestContext.CurrentContext.TestDirectory + @"\TestData\test_data_1.csv";
            var calculator    = OptimalLendRateCalculatorFactory.GetOptimalLendRateCalculator(filePath, requestAmount);
            var oRate         = calculator.GetOptimalLendRateInformation();

            Assert.IsNotNull(oRate);
            var outputString = "Rate: 7.0%\nMonthly repayment: £37.73\nTotal repayment: £1,358.21\n";

            Assert.AreEqual(outputString, oRate.ToString(), "ToString doesn't seem right!");
        }