void PayPeriod_GetPayPeriod_Test() { //Assign ProcessingPayLineVm ppl = new ProcessingPayLineVm { AnnualGrossSalary = "120000", FirstName = "DavidTest", LastName = "RuddTest", SuperAnnuationRate = "10%", StartDateTime = "01 March 2013-31 March 2013", }; Customer cust = TestStubs.GetCustomer(); //Act PayPeriod actual = ppl.GetPayPeriod(); CompareLogic compareLogic = new CompareLogic(); ComparisonResult result = compareLogic.Compare(cust.PayPeriod, actual); //Assert Assert.True(result.AreEqual); }
/// <summary> /// Parses the tax line for CSV /// </summary> /// <param name="line"></param> public void ProcessLine(string line) { if (!string.IsNullOrEmpty(line)) { string[] processLine = line.Split(','); if (processLine.Length > 0) { ProcessingPayLineVm pvm = new ProcessingPayLineVm { FirstName = processLine[Convert.ToInt32(CsvProcessingIndex.FirstName)], LastName = processLine[Convert.ToInt32(CsvProcessingIndex.LastName)], AnnualGrossSalary = processLine[Convert.ToInt32(CsvProcessingIndex.GrossIncome)], SuperAnnuationRate = processLine[Convert.ToInt32(CsvProcessingIndex.SuperAnnuationRate)], StartDateTime = processLine[Convert.ToInt32(CsvProcessingIndex.DatePeriod)], }; Customer customer = Mapper.Map<Customer>(pvm); // This is ensure the model mapping from the automapper is valid domain model CustomerValidator cv = new CustomerValidator(); var results = cv.Validate(customer); if (results.IsValid) { var outputLine = _salarySlipService.GenerateSalarySlip(customer, TimeFrequency.Monthly); if (outputLine != null) { _outputWriter.WriteLine(" "+outputLine.ToConsoleLineString()); } else { throw new Exception("Customer salary slip details not valid"); } } else { throw new Exception("Customer details not valid"); } } } }