Ejemplo n.º 1
0
        /// <summary>
        /// Start processing person object from reading, parsing, validating, sorting, and writing to output file
        /// </summary>
        /// <param name="reader">person data provider</param>
        /// <param name="parser">person data parser</param>
        /// <param name="writer">person data writer</param>
        /// <param name="validator">person data validator</param>
        /// <param name="sorter">person data sorter</param>
        /// <returns>List of persons</returns>
        public IList <PersonDTO> Process()
        {
            Messages = new List <String>();

            var providedData = _reader.Read();

            var parsedData = _parser.Parse(providedData);

            var validatedData = _validator.Validate(parsedData);

            var sortedData = _sorter.Sort(validatedData);

            _writer.Write(sortedData);

            Messages = Messages.Concat(_validator.Messages);

            return(sortedData);
        }