Esempio n. 1
0
        public void Can_Read_Input_File_With_Valid_Data()
        {
            var reader   = new JsonInputReader();
            var filename = (Path.Combine(Assembly.GetExecutingAssembly().Location, "..\\..\\..\\TestFiles\\InputFile.json"));

            var employees = reader.ReadEmployeeData(filename).ToList();

            Assert.AreEqual(2, employees.Count());

            var firstEmployee = employees.First();

            Assert.AreEqual("David", firstEmployee.FirstName);
            Assert.AreEqual("Rudd", firstEmployee.LastName);
            Assert.AreEqual(60050, firstEmployee.Salary);
            Assert.AreEqual(9, firstEmployee.SuperRate);
            Assert.AreEqual("01 March to 31 March", firstEmployee.PayPeriod);

            var lastEmployee = employees.Last();

            Assert.AreEqual("Ryan", lastEmployee.FirstName);
            Assert.AreEqual("Chen", lastEmployee.LastName);
            Assert.AreEqual(120000, lastEmployee.Salary);
            Assert.AreEqual(10, lastEmployee.SuperRate);
            Assert.AreEqual("01 March to 31 March", lastEmployee.PayPeriod);
        }
Esempio n. 2
0
        private static IEnumerable <Employee> GetEmployeesFromFile(string inputFilename)
        {
            var inputReader = new JsonInputReader();
            var employees   = inputReader.ReadEmployeeData(inputFilename);

            return(employees);
        }