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); }
public Candidate_Code_Test.DAL.CustomerItem PopulateCustomerItem() { Candidate_Code_Test.DAL.CustomerItem customerItem = new Candidate_Code_Test.DAL.CustomerItem(); customerItem.ID = 1; customerItem.Title = "Mr"; customerItem.FirstName = "Chris"; customerItem.SurName = "Quilliam"; customerItem.ProductName = "Standard Cover"; customerItem.PaymentAmount = 190820; customerItem.AnnualPremium = 50; return(customerItem); }