public Player Handle(PlayerQuery query) { var rosterRequest = new RosterRequest(); var roster = rosterRequest.LoadData( Constants.Seasons.Season2018, SlugFor(query.TeamCode)); var result = new Player(); foreach (var playerDto in roster) { if (playerDto.FirstName == query.FirstName && playerDto.LastName == query.LastName) { var player = new Player { Name = $"{playerDto.FirstName} {playerDto.LastName}", BirthDate = DateTime.Parse(playerDto.BirthDate), IsActive = playerDto.Active }; result = player; break; } } return(result); }
public void ChiefsRoster_ForSeason2018_ReturnsDto() { var sut = new RosterRequest(); var result = sut.LoadData( Constants.Seasons.Season2018, "nfl-kc"); Assert.IsNotNull(result); Assert.IsTrue(result.Count > 0); DumpPlayerDto(result); }
public void TeamRoster_ForSeason2019_ReturnsDto() { var team = "mlb-phi"; var sut = new RosterRequest(); var result = sut.LoadData( Constants.MlbSeasons.Season2019, team); Assert.IsNotNull(result); Assert.IsTrue(result.Count > 0); DumpPlayerDto(result, team); }