Example #1
0
        public void testDeserializeCompetitionData()
        {
            StreamReader jsonReader = new StreamReader(@"../../Data/competitions.json");
            string       json       = jsonReader.ReadToEnd();

            jsonReader.Close();

            var list = target.DeserializeCompetitionList(json);

            Assert.AreEqual(1, list.Count, "Competition list should only have one item");
            Assert.AreEqual("Premier League", list[0].Name);
        }
Example #2
0
        public async Task <List <Competition> > GetAvailableCompetitionsAsync()
        {
            string             url = FormatGetCompetitionsRequest();
            List <Competition> competitions;

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

                competitions = deserializeFootbalDataService.DeserializeCompetitionList(webResponse);
            }
            catch (AggregateException ae)
            {
                throw ae.InnerException;
            }
            catch (Exception)
            {
                competitions = new List <Competition>();
                throw;
            }
            return(competitions);
        }