public void ReadRecords_CSVFile_ReturnResult() { FileStream inputFile = PayslipExtension.ReadInputFile(); Employee[] EmployeeRecords = new[] { new Employee { FirstName = "David", LastName = "Rudd", AnnualSalary = 60050M, SuperRate = 0.09M, PaymentStartDate = new PaymentPeriod(new DateTime(DateTime.Now.Year, 3, 1), new DateTime(DateTime.Now.Year, 3, 31)) } }; var EmployeeRecordsinFile = new EmployeeRecords().ReadRecords <Employee>(inputFile).ToArray(); for (int i = 0; i < EmployeeRecords.Length; i++) { Assert.Equal(EmployeeRecords[i].FirstName, EmployeeRecordsinFile[i].FirstName); Assert.Equal(EmployeeRecords[i].LastName, EmployeeRecordsinFile[i].LastName); Assert.Equal(EmployeeRecords[i].AnnualSalary, EmployeeRecordsinFile[i].AnnualSalary); Assert.Equal(EmployeeRecords[i].SuperRate, EmployeeRecordsinFile[i].SuperRate); Assert.Equal(EmployeeRecords[i].PaymentStartDate.EndDate, EmployeeRecordsinFile[i].PaymentStartDate.EndDate); Assert.Equal(EmployeeRecords[i].PaymentStartDate.StartDate, EmployeeRecordsinFile[i].PaymentStartDate.StartDate); } }
public void CalculateRecords_ReturnTrue() { FileStream inputFile = PayslipExtension.ReadInputFile(); var validation = new Validation(); Employee[] EmployeeRecords = new[] { new Employee { FirstName = "David", LastName = "Rudd", AnnualSalary = 60050M, SuperRate = 0.09M, PaymentStartDate = new PaymentPeriod(new DateTime(DateTime.Now.Year, 3, 1), new DateTime(DateTime.Now.Year, 3, 31)) } }; PayslipExtension.BuildPayslip().Calculate(EmployeeRecords, validation); Assert.True(validation.IsValid); }