public async Task Test_SeasonWatchedProgressArrayJsonReader_ReadArray_From_Stream_Complete() { var traktJsonReader = new ArrayJsonReader <ITraktSeasonWatchedProgress>(); using (var stream = JSON_COMPLETE.ToStream()) { var traktSeasonWatchedProgresses = await traktJsonReader.ReadArrayAsync(stream); traktSeasonWatchedProgresses.Should().NotBeNull().And.NotBeEmpty().And.HaveCount(3); var watchedProgresses = traktSeasonWatchedProgresses.ToArray(); watchedProgresses[0].Number.Should().Be(1); watchedProgresses[0].Aired.Should().Be(3); watchedProgresses[0].Completed.Should().Be(2); watchedProgresses[0].Episodes.Should().NotBeNull().And.HaveCount(2); var episodesWatchedProgress = watchedProgresses[0].Episodes.ToArray(); episodesWatchedProgress[0].Should().NotBeNull(); episodesWatchedProgress[0].Number.Should().Be(1); episodesWatchedProgress[0].Completed.Should().BeTrue(); episodesWatchedProgress[0].LastWatchedAt.Should().Be(DateTime.Parse("2011-04-18T01:00:00.000Z").ToUniversalTime()); episodesWatchedProgress[1].Should().NotBeNull(); episodesWatchedProgress[1].Number.Should().Be(2); episodesWatchedProgress[1].Completed.Should().BeTrue(); episodesWatchedProgress[1].LastWatchedAt.Should().Be(DateTime.Parse("2011-04-19T02:00:00.000Z").ToUniversalTime()); // ----------------------------------------------- watchedProgresses[1].Number.Should().Be(2); watchedProgresses[1].Aired.Should().Be(3); watchedProgresses[1].Completed.Should().Be(2); watchedProgresses[1].Episodes.Should().NotBeNull().And.HaveCount(2); episodesWatchedProgress = watchedProgresses[1].Episodes.ToArray(); episodesWatchedProgress[0].Should().NotBeNull(); episodesWatchedProgress[0].Number.Should().Be(1); episodesWatchedProgress[0].Completed.Should().BeTrue(); episodesWatchedProgress[0].LastWatchedAt.Should().Be(DateTime.Parse("2011-04-18T01:00:00.000Z").ToUniversalTime()); episodesWatchedProgress[1].Should().NotBeNull(); episodesWatchedProgress[1].Number.Should().Be(2); episodesWatchedProgress[1].Completed.Should().BeTrue(); episodesWatchedProgress[1].LastWatchedAt.Should().Be(DateTime.Parse("2011-04-19T02:00:00.000Z").ToUniversalTime()); // ----------------------------------------------- watchedProgresses[2].Number.Should().Be(3); watchedProgresses[2].Aired.Should().Be(3); watchedProgresses[2].Completed.Should().Be(2); watchedProgresses[2].Episodes.Should().NotBeNull().And.HaveCount(2); episodesWatchedProgress = watchedProgresses[2].Episodes.ToArray(); episodesWatchedProgress[0].Should().NotBeNull(); episodesWatchedProgress[0].Number.Should().Be(1); episodesWatchedProgress[0].Completed.Should().BeTrue(); episodesWatchedProgress[0].LastWatchedAt.Should().Be(DateTime.Parse("2011-04-18T01:00:00.000Z").ToUniversalTime()); episodesWatchedProgress[1].Should().NotBeNull(); episodesWatchedProgress[1].Number.Should().Be(2); episodesWatchedProgress[1].Completed.Should().BeTrue(); episodesWatchedProgress[1].LastWatchedAt.Should().Be(DateTime.Parse("2011-04-19T02:00:00.000Z").ToUniversalTime()); } }
public async Task Test_UserCustomListItemsPostResponseObjectJsonReader_ReadObject_From_Stream_Complete() { var jsonReader = new UserCustomListItemsPostResponseObjectJsonReader(); using (var stream = JSON_COMPLETE.ToStream()) { var customListItemsPostResponse = await jsonReader.ReadObjectAsync(stream); customListItemsPostResponse.Should().NotBeNull(); customListItemsPostResponse.Added.Should().NotBeNull(); customListItemsPostResponse.Added.Movies.Should().Be(1); customListItemsPostResponse.Added.Shows.Should().Be(2); customListItemsPostResponse.Added.Seasons.Should().Be(3); customListItemsPostResponse.Added.Episodes.Should().Be(4); customListItemsPostResponse.Added.People.Should().Be(5); customListItemsPostResponse.Existing.Should().NotBeNull(); customListItemsPostResponse.Existing.Movies.Should().Be(1); customListItemsPostResponse.Existing.Shows.Should().Be(2); customListItemsPostResponse.Existing.Seasons.Should().Be(3); customListItemsPostResponse.Existing.Episodes.Should().Be(4); customListItemsPostResponse.Existing.People.Should().Be(5); customListItemsPostResponse.NotFound.Should().NotBeNull(); var notFound = customListItemsPostResponse.NotFound; notFound.Movies.Should().NotBeNull().And.NotBeEmpty().And.HaveCount(2); var movies = notFound.Movies.ToArray(); movies[0].Should().NotBeNull(); movies[0].Ids.Should().NotBeNull(); movies[0].Ids.Trakt.Should().Be(94024U); movies[0].Ids.Slug.Should().Be("star-wars-the-force-awakens-2015"); movies[0].Ids.Imdb.Should().Be("tt2488496"); movies[0].Ids.Tmdb.Should().Be(140607U); movies[1].Should().NotBeNull(); movies[1].Ids.Should().NotBeNull(); movies[1].Ids.Trakt.Should().Be(172687U); movies[1].Ids.Slug.Should().Be("king-arthur-legend-of-the-sword-2017"); movies[1].Ids.Imdb.Should().Be("tt1972591"); movies[1].Ids.Tmdb.Should().Be(274857U); // -------------------------------------------------- notFound.Shows.Should().NotBeNull().And.NotBeEmpty().And.HaveCount(2); var shows = notFound.Shows.ToArray(); shows[0].Should().NotBeNull(); shows[0].Ids.Should().NotBeNull(); shows[0].Ids.Trakt.Should().Be(1390U); shows[0].Ids.Slug.Should().Be("game-of-thrones"); shows[0].Ids.Tvdb.Should().Be(121361U); shows[0].Ids.Imdb.Should().Be("tt0944947"); shows[0].Ids.Tmdb.Should().Be(1399U); shows[0].Ids.TvRage.Should().Be(24493U); shows[1].Should().NotBeNull(); shows[1].Ids.Should().NotBeNull(); shows[1].Ids.Trakt.Should().Be(60300U); shows[1].Ids.Slug.Should().Be("the-flash-2014"); shows[1].Ids.Tvdb.Should().Be(279121U); shows[1].Ids.Imdb.Should().Be("tt3107288"); shows[1].Ids.Tmdb.Should().Be(60735U); shows[1].Ids.TvRage.Should().Be(36939U); // -------------------------------------------------- notFound.Seasons.Should().NotBeNull().And.NotBeEmpty().And.HaveCount(2); var seasons = notFound.Seasons.ToArray(); seasons[0].Should().NotBeNull(); seasons[0].Ids.Should().NotBeNull(); seasons[0].Ids.Trakt.Should().Be(61430U); seasons[0].Ids.Tvdb.Should().Be(279121U); seasons[0].Ids.Tmdb.Should().Be(60523U); seasons[0].Ids.TvRage.Should().Be(36939U); seasons[1].Should().NotBeNull(); seasons[1].Ids.Should().NotBeNull(); seasons[1].Ids.Trakt.Should().Be(61431U); seasons[1].Ids.Tvdb.Should().Be(578373U); seasons[1].Ids.Tmdb.Should().Be(60524U); seasons[1].Ids.TvRage.Should().Be(36940U); // -------------------------------------------------- notFound.Episodes.Should().NotBeNull().And.NotBeEmpty().And.HaveCount(2); var episodes = notFound.Episodes.ToArray(); episodes[0].Should().NotBeNull(); episodes[0].Ids.Should().NotBeNull(); episodes[0].Ids.Trakt.Should().Be(73640U); episodes[0].Ids.Tvdb.Should().Be(3254641U); episodes[0].Ids.Imdb.Should().Be("tt1480055"); episodes[0].Ids.Tmdb.Should().Be(63056U); episodes[0].Ids.TvRage.Should().Be(1065008299U); episodes[1].Should().NotBeNull(); episodes[1].Ids.Should().NotBeNull(); episodes[1].Ids.Trakt.Should().Be(73641U); episodes[1].Ids.Tvdb.Should().Be(3436411U); episodes[1].Ids.Imdb.Should().Be("tt1668746"); episodes[1].Ids.Tmdb.Should().Be(63057U); episodes[1].Ids.TvRage.Should().Be(1065023912U); // -------------------------------------------------- notFound.People.Should().NotBeNull().And.NotBeEmpty().And.HaveCount(2); var people = notFound.People.ToArray(); people[0].Should().NotBeNull(); people[0].Ids.Should().NotBeNull(); people[0].Ids.Trakt.Should().Be(297737U); people[0].Ids.Slug.Should().Be("bryan-cranston"); people[0].Ids.Imdb.Should().Be("nm0186505"); people[0].Ids.Tmdb.Should().Be(17419U); people[0].Ids.TvRage.Should().Be(1797U); people[1].Should().NotBeNull(); people[1].Ids.Should().NotBeNull(); people[1].Ids.Trakt.Should().Be(9486U); people[1].Ids.Slug.Should().Be("samuel-l-jackson"); people[1].Ids.Imdb.Should().Be("nm0000168"); people[1].Ids.Tmdb.Should().Be(2231U); people[1].Ids.TvRage.Should().Be(55720U); } }
public async Task Test_WatchedShowObjectJsonReader_ReadObject_From_Stream_Complete() { var jsonReader = new WatchedShowObjectJsonReader(); using (var stream = JSON_COMPLETE.ToStream()) { var traktWatchedShow = await jsonReader.ReadObjectAsync(stream); traktWatchedShow.Should().NotBeNull(); traktWatchedShow.Plays.Should().Be(1); traktWatchedShow.LastWatchedAt.Should().Be(DateTime.Parse("2014-09-01T09:10:11.000Z").ToUniversalTime()); traktWatchedShow.LastUpdatedAt.Should().Be(DateTime.Parse("2014-09-01T09:10:11.000Z").ToUniversalTime()); traktWatchedShow.ResetAt.Should().Be(DateTime.Parse("2014-09-01T09:10:11.000Z").ToUniversalTime()); traktWatchedShow.Show.Should().NotBeNull(); traktWatchedShow.Show.Title.Should().Be("Game of Thrones"); traktWatchedShow.Show.Year.Should().Be(2011); traktWatchedShow.Show.Ids.Should().NotBeNull(); traktWatchedShow.Show.Ids.Trakt.Should().Be(1390U); traktWatchedShow.Show.Ids.Slug.Should().Be("game-of-thrones"); traktWatchedShow.Show.Ids.Tvdb.Should().Be(121361U); traktWatchedShow.Show.Ids.Imdb.Should().Be("tt0944947"); traktWatchedShow.Show.Ids.Tmdb.Should().Be(1399U); traktWatchedShow.Show.Ids.TvRage.Should().Be(24493U); traktWatchedShow.WatchedSeasons.Should().NotBeNull().And.HaveCount(2); var seasons = traktWatchedShow.WatchedSeasons.ToArray(); seasons[0].Should().NotBeNull(); seasons[0].Number.Should().Be(1); seasons[0].Episodes.Should().NotBeNull().And.HaveCount(2); var episodes = seasons[0].Episodes.ToArray(); episodes[0].Should().NotBeNull(); episodes[0].Number.Should().Be(1); episodes[0].Plays.Should().Be(1); episodes[0].LastWatchedAt.Should().Be(DateTime.Parse("2014-09-01T09:10:11.000Z").ToUniversalTime()); episodes[1].Should().NotBeNull(); episodes[1].Number.Should().Be(2); episodes[1].Plays.Should().Be(1); episodes[1].LastWatchedAt.Should().Be(DateTime.Parse("2014-09-01T09:10:11.000Z").ToUniversalTime()); seasons[1].Should().NotBeNull(); seasons[1].Number.Should().Be(2); seasons[1].Episodes.Should().NotBeNull().And.HaveCount(2); episodes = seasons[1].Episodes.ToArray(); episodes[0].Should().NotBeNull(); episodes[0].Number.Should().Be(1); episodes[0].Plays.Should().Be(1); episodes[0].LastWatchedAt.Should().Be(DateTime.Parse("2014-09-01T09:10:11.000Z").ToUniversalTime()); episodes[1].Should().NotBeNull(); episodes[1].Number.Should().Be(2); episodes[1].Plays.Should().Be(1); episodes[1].LastWatchedAt.Should().Be(DateTime.Parse("2014-09-01T09:10:11.000Z").ToUniversalTime()); } }
public async Task Test_CrewArrayJsonReader_ReadArray_From_Stream_Complete() { var jsonReader = new ArrayJsonReader <ITraktCrew>(); using (var stream = JSON_COMPLETE.ToStream()) { IEnumerable <ITraktCrew> traktCrews = await jsonReader.ReadArrayAsync(stream); traktCrews.Should().NotBeNull(); ITraktCrew[] crews = traktCrews.ToArray(); crews[0].Production.Should().NotBeNull().And.HaveCount(1); ITraktCrewMember[] productionCrew = crews[0].Production.ToArray(); productionCrew[0].Should().NotBeNull(); productionCrew[0].Jobs.Should().NotBeNull().And.HaveCount(1).And.Contain("Producer"); productionCrew[0].Person.Should().NotBeNull(); productionCrew[0].Person.Name.Should().Be("Bryan Cranston"); productionCrew[0].Person.Ids.Should().NotBeNull(); productionCrew[0].Person.Ids.Trakt.Should().Be(297737U); productionCrew[0].Person.Ids.Slug.Should().Be("bryan-cranston"); productionCrew[0].Person.Ids.Imdb.Should().Be("nm0186505"); productionCrew[0].Person.Ids.Tmdb.Should().Be(17419U); productionCrew[0].Person.Ids.TvRage.Should().Be(1797U); crews[0].Art.Should().BeNull(); crews[0].Crew.Should().BeNull(); crews[0].CostumeAndMakeup.Should().BeNull(); crews[0].Directing.Should().BeNull(); crews[0].Writing.Should().BeNull(); crews[0].Sound.Should().BeNull(); crews[0].Camera.Should().BeNull(); crews[0].Lighting.Should().BeNull(); crews[0].VisualEffects.Should().BeNull(); crews[0].Editing.Should().BeNull(); crews[1].Production.Should().NotBeNull().And.HaveCount(1); productionCrew = crews[1].Production.ToArray(); productionCrew[0].Should().NotBeNull(); productionCrew[0].Jobs.Should().NotBeNull().And.HaveCount(1).And.Contain("Producer"); productionCrew[0].Person.Should().NotBeNull(); productionCrew[0].Person.Name.Should().Be("Bryan Cranston"); productionCrew[0].Person.Ids.Should().NotBeNull(); productionCrew[0].Person.Ids.Trakt.Should().Be(297737U); productionCrew[0].Person.Ids.Slug.Should().Be("bryan-cranston"); productionCrew[0].Person.Ids.Imdb.Should().Be("nm0186505"); productionCrew[0].Person.Ids.Tmdb.Should().Be(17419U); productionCrew[0].Person.Ids.TvRage.Should().Be(1797U); crews[1].Art.Should().BeNull(); crews[1].Crew.Should().BeNull(); crews[1].CostumeAndMakeup.Should().BeNull(); crews[1].Directing.Should().BeNull(); crews[1].Writing.Should().BeNull(); crews[1].Sound.Should().BeNull(); crews[1].Camera.Should().BeNull(); crews[1].Lighting.Should().BeNull(); crews[1].VisualEffects.Should().BeNull(); crews[1].Editing.Should().BeNull(); } }
public async Task Test_UserStatisticsObjectJsonReader_ReadObject_From_Stream_Complete() { var jsonReader = new UserStatisticsObjectJsonReader(); using (var stream = JSON_COMPLETE.ToStream()) { var userStatistics = await jsonReader.ReadObjectAsync(stream); userStatistics.Should().NotBeNull(); userStatistics.Movies.Should().NotBeNull(); userStatistics.Movies.Plays.Should().Be(552); userStatistics.Movies.Watched.Should().Be(534); userStatistics.Movies.Minutes.Should().Be(17330); userStatistics.Movies.Collected.Should().Be(117); userStatistics.Movies.Ratings.Should().Be(64); userStatistics.Movies.Comments.Should().Be(14); userStatistics.Shows.Should().NotBeNull(); userStatistics.Shows.Watched.Should().Be(534); userStatistics.Shows.Collected.Should().Be(117); userStatistics.Shows.Ratings.Should().Be(64); userStatistics.Shows.Comments.Should().Be(14); userStatistics.Seasons.Should().NotBeNull(); userStatistics.Seasons.Ratings.Should().Be(6); userStatistics.Seasons.Comments.Should().Be(1); userStatistics.Episodes.Should().NotBeNull(); userStatistics.Episodes.Plays.Should().Be(552); userStatistics.Episodes.Watched.Should().Be(534); userStatistics.Episodes.Minutes.Should().Be(17330); userStatistics.Episodes.Collected.Should().Be(117); userStatistics.Episodes.Ratings.Should().Be(64); userStatistics.Episodes.Comments.Should().Be(14); userStatistics.Network.Should().NotBeNull(); userStatistics.Network.Friends.Should().Be(1); userStatistics.Network.Followers.Should().Be(4); userStatistics.Network.Following.Should().Be(11); userStatistics.Ratings.Should().NotBeNull(); userStatistics.Ratings.Total.Should().Be(9257); userStatistics.Ratings.Distribution.Should().NotBeNull(); userStatistics.Ratings.Distribution.Should().NotBeEmpty(); userStatistics.Ratings.Distribution.Should().HaveCount(10); userStatistics.Ratings.Distribution.Should().Contain(new Dictionary <string, int> { ["1"] = 78, ["2"] = 45, ["3"] = 55, ["4"] = 96, ["5"] = 183, ["6"] = 545, ["7"] = 1361, ["8"] = 2259, ["9"] = 1772, ["10"] = 2863 }); } }