public void testDeserializeListOfTeamsIsSuccessful() { StreamReader jsonReader = new StreamReader(@"../../Data/standingsSuccessful.json"); string json = jsonReader.ReadToEnd(); jsonReader.Close(); var list = target.DeserializeTeamsList(json); Assert.AreEqual(20, list.Count, "List of teams should have 20 elements"); Assert.AreEqual("Chelsea", list.First().TeamName, "First place should be Chelsea"); Assert.AreEqual("Queens Park Rangers", list.Last().TeamName, "Last place should be QPR"); }
public async Task <List <Team> > GetCurrentStandingsAsync(int competitionId) { string url = FormatGetCurrentStandingsRequest(competitionId); List <Team> currentStandings; try { string webResponse = await dataService.MakeJsonWebRequestAsync(url); currentStandings = deserializeFootbalDataService.DeserializeTeamsList(webResponse); } catch (Exception) { currentStandings = new List <Team>(); } return(currentStandings); }