コード例 #1
0
        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);
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        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);
        }