Ejemplo n.º 1
0
        public void CustomerItemTests_InputFile_ImportCorrectly()
        {
            Candidate_Code_Test.DAL.IDataRepo dataRepo = new Candidate_Code_Test.DAL.DataRepo(Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location));

            List <Candidate_Code_Test.DAL.CustomerItem> customerList = dataRepo.GetCustomersFromInputFile(Path.Combine(Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location), "Input Test Files\\Customer_File1.csv"));

            int expectedCount = 1;
            int actualCount   = customerList.Count;

            Assert.AreEqual(expectedCount, actualCount);

            foreach (Candidate_Code_Test.DAL.CustomerItem customerListItem in customerList)
            {
                customerListItem.CalculateMonthlyPayments();
            }

            CommonMethods commonMethods = new CommonMethods();

            Candidate_Code_Test.DAL.CustomerItem customerItem = commonMethods.PopulateCustomerItem();
            customerItem.CalculateMonthlyPayments();
            bool expectedEquality = true;


            bool actualEquality = commonMethods.CompareObjects(customerList[0], customerItem);

            Assert.AreEqual(expectedEquality, actualEquality);
        }
Ejemplo n.º 2
0
        public void CustomerItemTests_InputFile_Import_Incorrect_AnnualPremium()
        {
            Candidate_Code_Test.DAL.IDataRepo dataRepo = new Candidate_Code_Test.DAL.DataRepo(Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location));

            List <Candidate_Code_Test.DAL.CustomerItem> customerList = dataRepo.GetCustomersFromInputFile(Path.Combine(Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location), "Input Test Files\\Customer_File_IncorrectAnnualPremium.csv"));

            bool expected = false;
            bool actual   = customerList[0].IsValid;

            Assert.AreEqual(expected, actual);
        }
Ejemplo n.º 3
0
        public void CustomerItemTests_File_Not_Found()
        {
            Candidate_Code_Test.DAL.IDataRepo dataRepo = new Candidate_Code_Test.DAL.DataRepo(Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location));

            dataRepo.GetCustomersFromInputFile(Path.Combine(Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location), "Input Test Files\\Customer_File_DoesntExist.csv"));
        }