Ejemplo n.º 1
0
        public void testDeserializeFixturesData()
        {
            StreamReader jsonReader = new StreamReader(@"../../Data/fixtures.json");
            string       json       = jsonReader.ReadToEnd();

            jsonReader.Close();

            var list = target.DeserializeMatchesList(json);

            Assert.AreEqual(4, list.Count, "Fixtures list should have 4 matches");
            Assert.AreEqual("Manchester United", list[0].LocalTeamName, "Local team for first match is not the expected");
        }
Ejemplo n.º 2
0
        public async Task <List <Match> > GetFixturesForDateAsync(int competitionId, DateTime date)
        {
            string       url = FormatGetFixturesRequest(competitionId, date);
            List <Match> fixtures;

            try
            {
                string webResponse = await dataService.MakeJsonWebRequestAsync(url);

                fixtures = deserializeFootbalDataService.DeserializeMatchesList(webResponse);
            }
            catch (Exception)
            {
                fixtures = new List <Match>();
            }
            return(fixtures);
        }