Example #1
0
        public async Task <MinGoalDifferentialResponse> Handle(MinGoalDifferentialCommand request, CancellationToken cancellationToken)
        {
            var fileDesc = new FootballFileDescription(kata04Config.FootballFilePath);
            FootballDataReader reader = new FootballDataReader(fileDesc);

            using (var stream = new StreamReader(kata04Config.FootballFilePath))
            {
                var result = await reader.ProcessFile(stream);

                return(new MinGoalDifferentialResponse
                {
                    TeamName = result.FootballData
                               .Select(f => new { Team = f.Team, Differntial = f.For - f.Against })
                               .OrderBy(m => m.Differntial)
                               .First().Team
                });
            }
        }
Example #2
0
 public FootballDataReader(FootballFileDescription fileDescription)
 {
     _fileDescription = fileDescription;
     _fieldParser     = new FieldParser(_fileDescription.DataFields);
 }