public void ShowExtendedSeasons_ValidId_ReturnSeasons() { //Arrange _showExtendedService.GetSeasons(Arg.Any <int>()) .Returns(_jsonSerializeService.SerializeObject(_mockSeasonDtos)); //Act var seasons = _apiClientMock.GetSeasons(1); //Assert Assert.AreEqual(_jsonSerializeService.SerializeObject(_mockSeasonDtos), _jsonSerializeService.SerializeObject(seasons.Result)); }
public async Task <IEnumerable <SeasonDto> > GetSeasons(int showId) { var json = await _showExtendedService.GetSeasons(showId); var seasons = _jsonSerializeService.TryDeserializeObject <IEnumerable <SeasonDto> >(json); if (seasons.success) { return(seasons.obj); } throw new InvalidSeasonException($"Get season for showId: {showId}"); }