public async Task Test_MovieScrobblePostResponseObjectJsonReader_ReadObject_From_Stream_Complete() { var jsonReader = new MovieScrobblePostResponseObjectJsonReader(); using (var stream = JSON_COMPLETE.ToStream()) { var movieScrobbleResponse = await jsonReader.ReadObjectAsync(stream); movieScrobbleResponse.Should().NotBeNull(); movieScrobbleResponse.Id.Should().Be(3373536623UL); movieScrobbleResponse.Action.Should().Be(TraktScrobbleActionType.Stop); movieScrobbleResponse.Progress.Should().Be(85.9f); movieScrobbleResponse.Sharing.Should().NotBeNull(); movieScrobbleResponse.Sharing.Twitter.Should().BeTrue(); movieScrobbleResponse.Sharing.Google.Should().BeTrue(); movieScrobbleResponse.Sharing.Tumblr.Should().BeTrue(); movieScrobbleResponse.Sharing.Medium.Should().BeTrue(); movieScrobbleResponse.Sharing.Slack.Should().BeTrue(); movieScrobbleResponse.Movie.Should().NotBeNull(); movieScrobbleResponse.Movie.Title.Should().Be("Star Wars: The Force Awakens"); movieScrobbleResponse.Movie.Year.Should().Be(2015); movieScrobbleResponse.Movie.Ids.Should().NotBeNull(); movieScrobbleResponse.Movie.Ids.Trakt.Should().Be(94024U); movieScrobbleResponse.Movie.Ids.Slug.Should().Be("star-wars-the-force-awakens-2015"); movieScrobbleResponse.Movie.Ids.Imdb.Should().Be("tt2488496"); movieScrobbleResponse.Movie.Ids.Tmdb.Should().Be(140607U); } }
public async Task Test_EpisodeIdsArrayJsonReader_ReadArray_From_Stream_Complete() { var traktJsonReader = new ArrayJsonReader <ITraktEpisodeIds>(); using (var stream = JSON_COMPLETE.ToStream()) { var traktEpisodeIds = await traktJsonReader.ReadArrayAsync(stream); traktEpisodeIds.Should().NotBeNull().And.NotBeEmpty().And.HaveCount(2); var episodeIds = traktEpisodeIds.ToArray(); episodeIds[0].Should().NotBeNull(); episodeIds[0].Trakt.Should().Be(73640); episodeIds[0].Tvdb.Should().Be(3254641U); episodeIds[0].Imdb.Should().Be("tt1480055"); episodeIds[0].Tmdb.Should().Be(63056U); episodeIds[0].TvRage.Should().Be(1065008299U); episodeIds[0].HasAnyId.Should().BeTrue(); episodeIds[1].Should().NotBeNull(); episodeIds[1].Trakt.Should().Be(73640); episodeIds[1].Tvdb.Should().Be(3254641U); episodeIds[1].Imdb.Should().Be("tt1480055"); episodeIds[1].Tmdb.Should().Be(63056U); episodeIds[1].TvRage.Should().Be(1065008299U); episodeIds[1].HasAnyId.Should().BeTrue(); } }
public async Task Test_CastMemberArrayJsonReader_ReadObject_From_Stream_Complete() { var jsonReader = new ArrayJsonReader <ITraktCastMember>(); using (var stream = JSON_COMPLETE.ToStream()) { var traktCastMembers = await jsonReader.ReadArrayAsync(stream); traktCastMembers.Should().NotBeNull(); var items = traktCastMembers.ToArray(); items[0].Should().NotBeNull(); items[0].Characters.Should().NotBeNull().And.HaveCount(1).And.Contain("Joe Brody"); items[0].Person.Should().NotBeNull(); items[0].Person.Name.Should().Be("Bryan Cranston"); items[0].Person.Ids.Should().NotBeNull(); items[0].Person.Ids.Trakt.Should().Be(297737U); items[0].Person.Ids.Slug.Should().Be("bryan-cranston"); items[0].Person.Ids.Imdb.Should().Be("nm0186505"); items[0].Person.Ids.Tmdb.Should().Be(17419U); items[0].Person.Ids.TvRage.Should().Be(1797U); items[1].Should().NotBeNull(); items[1].Characters.Should().NotBeNull().And.HaveCount(1).And.Contain("Jules Winfield"); items[1].Person.Should().NotBeNull(); items[1].Person.Name.Should().Be("Samuel L.Jackson"); items[1].Person.Ids.Should().NotBeNull(); items[1].Person.Ids.Trakt.Should().Be(9486U); items[1].Person.Ids.Slug.Should().Be("samuel-l-jackson"); items[1].Person.Ids.Imdb.Should().Be("nm0000168"); items[1].Person.Ids.Tmdb.Should().Be(2231U); items[1].Person.Ids.TvRage.Should().Be(55720U); } }
public async Task Test_CalendarMovieArrayJsonReader_ReadArray_From_Stream_Complete() { var jsonReader = new ArrayJsonReader <ITraktCalendarMovie>(); using (var stream = JSON_COMPLETE.ToStream()) { IEnumerable <ITraktCalendarMovie> traktCalendarMovies = await jsonReader.ReadArrayAsync(stream); traktCalendarMovies.Should().NotBeNull(); ITraktCalendarMovie[] calendarMovies = traktCalendarMovies.ToArray(); calendarMovies[0].Should().NotBeNull(); calendarMovies[0].CalendarRelease.Should().Be(DateTime.Parse("2014-08-01")); calendarMovies[0].Movie.Should().NotBeNull(); calendarMovies[0].Movie.Title.Should().Be("Star Wars: The Force Awakens"); calendarMovies[0].Movie.Year.Should().Be(2015); calendarMovies[0].Movie.Ids.Should().NotBeNull(); calendarMovies[0].Movie.Ids.Trakt.Should().Be(94024U); calendarMovies[0].Movie.Ids.Slug.Should().Be("star-wars-the-force-awakens-2015"); calendarMovies[0].Movie.Ids.Imdb.Should().Be("tt2488496"); calendarMovies[0].Movie.Ids.Tmdb.Should().Be(140607U); calendarMovies[1].Should().NotBeNull(); calendarMovies[1].CalendarRelease.Should().Be(DateTime.Parse("2014-08-01")); calendarMovies[1].Movie.Should().NotBeNull(); calendarMovies[1].Movie.Title.Should().Be("Star Wars: The Force Awakens"); calendarMovies[1].Movie.Year.Should().Be(2015); calendarMovies[1].Movie.Ids.Should().NotBeNull(); calendarMovies[1].Movie.Ids.Trakt.Should().Be(94024U); calendarMovies[1].Movie.Ids.Slug.Should().Be("star-wars-the-force-awakens-2015"); calendarMovies[1].Movie.Ids.Imdb.Should().Be("tt2488496"); calendarMovies[1].Movie.Ids.Tmdb.Should().Be(140607U); } }
public async Task Test_EpisodeCollectionProgressArrayJsonReader_ReadArray_From_Stream_Complete() { var traktJsonReader = new ArrayJsonReader <ITraktEpisodeCollectionProgress>(); using (var stream = JSON_COMPLETE.ToStream()) { var traktEpisodeCollectionProgresses = await traktJsonReader.ReadArrayAsync(stream); traktEpisodeCollectionProgresses.Should().NotBeNull().And.NotBeEmpty().And.HaveCount(3); var collectionProgress = traktEpisodeCollectionProgresses.ToArray(); collectionProgress[0].Number.Should().Be(1); collectionProgress[0].Completed.Should().BeTrue(); collectionProgress[0].CollectedAt.Should().Be(DateTime.Parse("2011-04-18T01:00:00.000Z").ToUniversalTime()); collectionProgress[1].Number.Should().Be(2); collectionProgress[1].Completed.Should().BeTrue(); collectionProgress[1].CollectedAt.Should().Be(DateTime.Parse("2011-04-18T01:00:00.000Z").ToUniversalTime()); collectionProgress[2].Number.Should().Be(3); collectionProgress[2].Completed.Should().BeTrue(); collectionProgress[2].CollectedAt.Should().Be(DateTime.Parse("2011-04-18T01:00:00.000Z").ToUniversalTime()); } }
public async Task Test_UserRatingsStatisticsObjectJsonReader_ReadObject_From_Stream_Complete() { var jsonReader = new UserRatingsStatisticsObjectJsonReader(); using (var stream = JSON_COMPLETE.ToStream()) { var userRatingsStatistics = await jsonReader.ReadObjectAsync(stream); userRatingsStatistics.Should().NotBeNull(); userRatingsStatistics.Total.Should().Be(9257); userRatingsStatistics.Distribution.Should().NotBeNull(); userRatingsStatistics.Distribution.Should().NotBeEmpty(); userRatingsStatistics.Distribution.Should().HaveCount(10); userRatingsStatistics.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 }); } }
public async Task Test_DeviceArrayJsonReader_ReadObject_From_Stream_Complete() { var objectJsonReader = new ArrayJsonReader <ITraktDevice>(); using (var stream = JSON_COMPLETE.ToStream()) { IEnumerable <ITraktDevice> traktDevices = await objectJsonReader.ReadArrayAsync(stream); traktDevices.Should().NotBeNull(); ITraktDevice[] items = traktDevices.ToArray(); items[0].Should().NotBeNull(); items[0].DeviceCode.Should().Be("mockDeviceCode1"); items[0].UserCode.Should().Be("mockUserCode1"); items[0].VerificationUrl.Should().Be("mockUrl1"); items[0].ExpiresInSeconds.Should().Be(7200U); items[0].IntervalInSeconds.Should().Be(600U); items[1].Should().NotBeNull(); items[1].DeviceCode.Should().Be("mockDeviceCode2"); items[1].UserCode.Should().Be("mockUserCode2"); items[1].VerificationUrl.Should().Be("mockUrl2"); items[1].ExpiresInSeconds.Should().Be(7200U); items[1].IntervalInSeconds.Should().Be(600U); } }
public async Task Test_CertificationsObjectStream_ReadObject_From_Stream_Complete() { var traktJsonReader = new CertificationsObjectJsonReader(); using (var stream = JSON_COMPLETE.ToStream()) { var traktCertifications = await traktJsonReader.ReadObjectAsync(stream); traktCertifications.Should().NotBeNull(); traktCertifications.US.Should().NotBeNull(); traktCertifications.US.Should().NotBeEmpty().And.HaveCount(2); var certifications = traktCertifications.US.ToArray(); certifications[0].Should().NotBeNull(); certifications[0].Name.Should().Be("PG"); certifications[0].Slug.Should().Be("pg"); certifications[0].Description.Should().Be("Parental Guidance Suggested"); certifications[1].Should().NotBeNull(); certifications[1].Name.Should().Be("PG-13"); certifications[1].Slug.Should().Be("pg-13"); certifications[1].Description.Should().Be("Parents Strongly Cautioned - Ages 13+ Recommended"); } }
public async Task Test_PostResponseNotFoundEpisodeArrayJsonReader_ReadArray_From_Stream_Complete() { var jsonReader = new ArrayJsonReader <ITraktPostResponseNotFoundEpisode>(); using (var stream = JSON_COMPLETE.ToStream()) { var notFoundEpisodes = await jsonReader.ReadArrayAsync(stream); notFoundEpisodes.Should().NotBeNull().And.NotBeEmpty().And.HaveCount(2); var notFoundEpisode = notFoundEpisodes.ToArray(); notFoundEpisode[0].Should().NotBeNull(); notFoundEpisode[0].Ids.Should().NotBeNull(); notFoundEpisode[0].Ids.Trakt.Should().Be(73640U); notFoundEpisode[0].Ids.Tvdb.Should().Be(3254641U); notFoundEpisode[0].Ids.Imdb.Should().Be("tt1480055"); notFoundEpisode[0].Ids.Tmdb.Should().Be(63056U); notFoundEpisode[0].Ids.TvRage.Should().Be(1065008299U); notFoundEpisode[1].Should().NotBeNull(); notFoundEpisode[1].Ids.Should().NotBeNull(); notFoundEpisode[1].Ids.Trakt.Should().Be(73641U); notFoundEpisode[1].Ids.Tvdb.Should().Be(3436411U); notFoundEpisode[1].Ids.Imdb.Should().Be("tt1668746"); notFoundEpisode[1].Ids.Tmdb.Should().Be(63057U); notFoundEpisode[1].Ids.TvRage.Should().Be(1065023912U); } }
public async Task Test_CrewMemberArrayJsonReader_ReadObject_From_Stream_Complete() { var jsonReader = new CrewMemberArrayJsonReader(); using (var stream = JSON_COMPLETE.ToStream()) { var traktCrewMembers = await jsonReader.ReadArrayAsync(stream); traktCrewMembers.Should().NotBeNull(); var items = traktCrewMembers.ToArray(); items[0].Should().NotBeNull(); items[0].Job.Should().Be("Director"); items[0].Person.Should().NotBeNull(); items[0].Person.Name.Should().Be("Bryan Cranston"); items[0].Person.Ids.Should().NotBeNull(); items[0].Person.Ids.Trakt.Should().Be(297737U); items[0].Person.Ids.Slug.Should().Be("bryan-cranston"); items[0].Person.Ids.Imdb.Should().Be("nm0186505"); items[0].Person.Ids.Tmdb.Should().Be(17419U); items[0].Person.Ids.TvRage.Should().Be(1797U); items[1].Should().NotBeNull(); items[1].Job.Should().Be("Director"); items[1].Person.Should().NotBeNull(); items[1].Person.Name.Should().Be("Samuel L.Jackson"); items[1].Person.Ids.Should().NotBeNull(); items[1].Person.Ids.Trakt.Should().Be(9486U); items[1].Person.Ids.Slug.Should().Be("samuel-l-jackson"); items[1].Person.Ids.Imdb.Should().Be("nm0000168"); items[1].Person.Ids.Tmdb.Should().Be(2231U); items[1].Person.Ids.TvRage.Should().Be(55720U); } }
public async Task Test_PersonMovieCreditsCastItemArrayJsonReader_ReadObject_From_Stream_Complete() { var jsonReader = new PersonMovieCreditsCastItemArrayJsonReader(); using (var stream = JSON_COMPLETE.ToStream()) { var movieCreditsCastItems = await jsonReader.ReadArrayAsync(stream); movieCreditsCastItems.Should().NotBeNull(); var items = movieCreditsCastItems.ToArray(); items[0].Should().NotBeNull(); items[0].Character.Should().Be("Joe Brody"); items[0].Movie.Should().NotBeNull(); items[0].Movie.Title.Should().Be("Star Wars: The Force Awakens"); items[0].Movie.Year.Should().Be(2015); items[0].Movie.Ids.Should().NotBeNull(); items[0].Movie.Ids.Trakt.Should().Be(94024U); items[0].Movie.Ids.Slug.Should().Be("star-wars-the-force-awakens-2015"); items[0].Movie.Ids.Imdb.Should().Be("tt2488496"); items[0].Movie.Ids.Tmdb.Should().Be(140607U); items[1].Should().NotBeNull(); items[1].Character.Should().Be("Sam Flynn"); items[1].Movie.Should().NotBeNull(); items[1].Movie.Title.Should().Be("TRON: Legacy"); items[1].Movie.Year.Should().Be(2010); items[1].Movie.Ids.Should().NotBeNull(); items[1].Movie.Ids.Trakt.Should().Be(12601U); items[1].Movie.Ids.Slug.Should().Be("tron-legacy-2010"); items[1].Movie.Ids.Imdb.Should().Be("tt1104001"); items[1].Movie.Ids.Tmdb.Should().Be(20526U); } }
public async Task Test_WatchedShowEpisodeArrayJsonReader_ReadArray_From_Stream_Complete() { var jsonReader = new ArrayJsonReader <ITraktWatchedShowEpisode>(); using (var stream = JSON_COMPLETE.ToStream()) { var traktWatchedShowEpisodes = await jsonReader.ReadArrayAsync(stream); traktWatchedShowEpisodes.Should().NotBeNull().And.NotBeEmpty().And.HaveCount(3); var watchedShowEpisodes = traktWatchedShowEpisodes.ToArray(); watchedShowEpisodes[0].Should().NotBeNull(); watchedShowEpisodes[0].Number.Should().Be(1); watchedShowEpisodes[0].Plays.Should().Be(1); watchedShowEpisodes[0].LastWatchedAt.Should().Be(DateTime.Parse("2014-10-12T17:00:54.000Z").ToUniversalTime()); watchedShowEpisodes[1].Should().NotBeNull(); watchedShowEpisodes[1].Number.Should().Be(2); watchedShowEpisodes[1].Plays.Should().Be(1); watchedShowEpisodes[1].LastWatchedAt.Should().Be(DateTime.Parse("2014-10-12T17:00:54.000Z").ToUniversalTime()); watchedShowEpisodes[2].Should().NotBeNull(); watchedShowEpisodes[2].Number.Should().Be(3); watchedShowEpisodes[2].Plays.Should().Be(1); watchedShowEpisodes[2].LastWatchedAt.Should().Be(DateTime.Parse("2014-10-12T17:00:54.000Z").ToUniversalTime()); } }
public async Task Test_MostPWCShowObjectJsonReader_ReadObject_From_Stream_Complete() { var traktJsonReader = new MostPWCShowObjectJsonReader(); using (var stream = JSON_COMPLETE.ToStream()) { var traktMostPWCShow = await traktJsonReader.ReadObjectAsync(stream); traktMostPWCShow.Should().NotBeNull(); traktMostPWCShow.WatcherCount.Should().Be(4992); traktMostPWCShow.PlayCount.Should().Be(7100); traktMostPWCShow.CollectedCount.Should().Be(1348); traktMostPWCShow.CollectorCount.Should().Be(7964); traktMostPWCShow.Show.Should().NotBeNull(); traktMostPWCShow.Show.Title.Should().Be("Game of Thrones"); traktMostPWCShow.Show.Year.Should().Be(2011); traktMostPWCShow.Show.Ids.Should().NotBeNull(); traktMostPWCShow.Show.Ids.Trakt.Should().Be(1390U); traktMostPWCShow.Show.Ids.Slug.Should().Be("game-of-thrones"); traktMostPWCShow.Show.Ids.Tvdb.Should().Be(121361U); traktMostPWCShow.Show.Ids.Imdb.Should().Be("tt0944947"); traktMostPWCShow.Show.Ids.Tmdb.Should().Be(1399U); traktMostPWCShow.Show.Ids.TvRage.Should().Be(24493U); } }
public async Task Test_CalendarShowObjectJsonReader_ReadObject_From_Stream_Complete() { var jsonReader = new CalendarShowObjectJsonReader(); using (var stream = JSON_COMPLETE.ToStream()) { var traktCalendarShow = await jsonReader.ReadObjectAsync(stream); traktCalendarShow.Should().NotBeNull(); traktCalendarShow.FirstAiredInCalendar.Should().Be(DateTime.Parse("2014-07-14T01:00:00.000Z").ToUniversalTime()); traktCalendarShow.Show.Should().NotBeNull(); traktCalendarShow.Show.Title.Should().Be("Game of Thrones"); traktCalendarShow.Show.Year.Should().Be(2011); traktCalendarShow.Show.Ids.Should().NotBeNull(); traktCalendarShow.Show.Ids.Trakt.Should().Be(1390U); traktCalendarShow.Show.Ids.Slug.Should().Be("game-of-thrones"); traktCalendarShow.Show.Ids.Tvdb.Should().Be(121361U); traktCalendarShow.Show.Ids.Imdb.Should().Be("tt0944947"); traktCalendarShow.Show.Ids.Tmdb.Should().Be(1399U); traktCalendarShow.Show.Ids.TvRage.Should().Be(24493U); traktCalendarShow.Episode.Should().NotBeNull(); traktCalendarShow.Episode.SeasonNumber.Should().Be(1); traktCalendarShow.Episode.Number.Should().Be(1); traktCalendarShow.Episode.Title.Should().Be("Winter Is Coming"); traktCalendarShow.Episode.Ids.Should().NotBeNull(); traktCalendarShow.Episode.Ids.Trakt.Should().Be(73640U); traktCalendarShow.Episode.Ids.Tvdb.Should().Be(3254641U); traktCalendarShow.Episode.Ids.Imdb.Should().Be("tt1480055"); traktCalendarShow.Episode.Ids.Tmdb.Should().Be(63056U); traktCalendarShow.Episode.Ids.TvRage.Should().Be(1065008299U); } }
public async Task Test_SeasonWatchedProgressObjectJsonReader_ReadObject_From_Stream_Complete() { var traktJsonReader = new SeasonWatchedProgressObjectJsonReader(); using (var stream = JSON_COMPLETE.ToStream()) { var traktSeasonWatchedProgress = await traktJsonReader.ReadObjectAsync(stream); traktSeasonWatchedProgress.Should().NotBeNull(); traktSeasonWatchedProgress.Number.Should().Be(2); traktSeasonWatchedProgress.Aired.Should().Be(3); traktSeasonWatchedProgress.Completed.Should().Be(2); traktSeasonWatchedProgress.Episodes.Should().NotBeNull().And.HaveCount(2); var episodesWatchedProgress = traktSeasonWatchedProgress.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_CommentLikeArrayJsonReader_ReadArray_From_Stream_Complete() { var jsonReader = new ArrayJsonReader <ITraktCommentLike>(); using (var stream = JSON_COMPLETE.ToStream()) { IEnumerable <ITraktCommentLike> traktCommentLikes = await jsonReader.ReadArrayAsync(stream); traktCommentLikes.Should().NotBeNull(); ITraktCommentLike[] commentLikes = traktCommentLikes.ToArray(); commentLikes[0].Should().NotBeNull(); commentLikes[0].LikedAt.Should().Be(DateTime.Parse("2014-10-11T17:00:54.000Z").ToUniversalTime()); commentLikes[0].User.Should().NotBeNull(); commentLikes[0].User.Username.Should().Be("sean"); commentLikes[0].User.IsPrivate.Should().BeFalse(); commentLikes[0].User.Name.Should().Be("Sean Rudford"); commentLikes[0].User.IsVIP.Should().BeTrue(); commentLikes[0].User.IsVIP_EP.Should().BeFalse(); commentLikes[0].User.Ids.Should().NotBeNull(); commentLikes[0].User.Ids.Slug.Should().Be("sean"); commentLikes[1].Should().NotBeNull(); commentLikes[1].LikedAt.Should().Be(DateTime.Parse("2014-10-11T17:00:54.000Z").ToUniversalTime()); commentLikes[1].User.Should().NotBeNull(); commentLikes[1].User.Username.Should().Be("sean"); commentLikes[1].User.IsPrivate.Should().BeFalse(); commentLikes[1].User.Name.Should().Be("Sean Rudford"); commentLikes[1].User.IsVIP.Should().BeTrue(); commentLikes[1].User.IsVIP_EP.Should().BeFalse(); commentLikes[1].User.Ids.Should().NotBeNull(); commentLikes[1].User.Ids.Slug.Should().Be("sean"); } }
public async Task Test_MetadataArrayJsonReader_ReadArray_From_Stream_Complete() { var jsonReader = new ArrayJsonReader <ITraktMetadata>(); using (var stream = JSON_COMPLETE.ToStream()) { IEnumerable <ITraktMetadata> traktMetadatas = await jsonReader.ReadArrayAsync(stream); traktMetadatas.Should().NotBeNull(); ITraktMetadata[] metadatas = traktMetadatas.ToArray(); metadatas[0].Should().NotBeNull(); metadatas[0].MediaType.Should().Be(TraktMediaType.Digital); metadatas[0].MediaResolution.Should().Be(TraktMediaResolution.HD_720p); metadatas[0].Audio.Should().Be(TraktMediaAudio.AAC); metadatas[0].AudioChannels.Should().Be(TraktMediaAudioChannel.Channels_5_1); metadatas[0].HDR.Should().Be(TraktMediaHDR.DolbyVision); metadatas[0].ThreeDimensional.Should().BeTrue(); metadatas[1].Should().NotBeNull(); metadatas[1].MediaType.Should().Be(TraktMediaType.Digital); metadatas[1].MediaResolution.Should().Be(TraktMediaResolution.HD_720p); metadatas[1].Audio.Should().Be(TraktMediaAudio.AAC); metadatas[1].AudioChannels.Should().Be(TraktMediaAudioChannel.Channels_5_1); metadatas[1].HDR.Should().Be(TraktMediaHDR.DolbyVision); metadatas[1].ThreeDimensional.Should().BeTrue(); } }
public async Task Test_UserFollowRequestObjectJsonReader_ReadObject_From_Stream_Complete() { var jsonReader = new UserFollowRequestObjectJsonReader(); using (var stream = JSON_COMPLETE.ToStream()) { var userFollowRequest = await jsonReader.ReadObjectAsync(stream); userFollowRequest.Should().NotBeNull(); userFollowRequest.Id.Should().Be(12345U); userFollowRequest.RequestedAt.Should().Be(DateTime.Parse("2014-09-01T09:10:11.000Z").ToUniversalTime()); userFollowRequest.User.Should().NotBeNull(); userFollowRequest.User.Username.Should().Be("sean"); userFollowRequest.User.IsPrivate.Should().BeFalse(); userFollowRequest.User.Name.Should().Be("Sean Rudford"); userFollowRequest.User.IsVIP.Should().BeTrue(); userFollowRequest.User.IsVIP_EP.Should().BeTrue(); userFollowRequest.User.Ids.Should().NotBeNull(); userFollowRequest.User.Ids.Slug.Should().Be("sean"); userFollowRequest.User.JoinedAt.Should().HaveValue().And.Be(DateTime.Parse("2010-09-25T17:49:25.000Z").ToUniversalTime()); userFollowRequest.User.Location.Should().Be("SF"); userFollowRequest.User.About.Should().Be("I have all your cassette tapes."); userFollowRequest.User.Gender.Should().Be("male"); userFollowRequest.User.Age.Should().Be(35); userFollowRequest.User.Images.Should().NotBeNull(); userFollowRequest.User.Images.Avatar.Should().NotBeNull(); userFollowRequest.User.Images.Avatar.Full.Should().Be("https://walter-dev.trakt.tv/images/users/000/000/001/avatars/large/0ba3f72910.jpg"); } }
public async Task Test_PersonMovieCreditsCrewItemArrayJsonReader_ReadObject_From_Stream_Complete() { var jsonReader = new ArrayJsonReader <ITraktPersonMovieCreditsCrewItem>(); using (var stream = JSON_COMPLETE.ToStream()) { var movieCreditsCrewItems = await jsonReader.ReadArrayAsync(stream); movieCreditsCrewItems.Should().NotBeNull(); var items = movieCreditsCrewItems.ToArray(); items[0].Should().NotBeNull(); items[0].Jobs.Should().NotBeNull().And.HaveCount(1).And.Contain("Director"); items[0].Movie.Should().NotBeNull(); items[0].Movie.Title.Should().Be("Star Wars: The Force Awakens"); items[0].Movie.Year.Should().Be(2015); items[0].Movie.Ids.Should().NotBeNull(); items[0].Movie.Ids.Trakt.Should().Be(94024U); items[0].Movie.Ids.Slug.Should().Be("star-wars-the-force-awakens-2015"); items[0].Movie.Ids.Imdb.Should().Be("tt2488496"); items[0].Movie.Ids.Tmdb.Should().Be(140607U); items[1].Should().NotBeNull(); items[1].Jobs.Should().NotBeNull().And.HaveCount(1).And.Contain("Producer"); items[1].Movie.Should().NotBeNull(); items[1].Movie.Title.Should().Be("TRON: Legacy"); items[1].Movie.Year.Should().Be(2010); items[1].Movie.Ids.Should().NotBeNull(); items[1].Movie.Ids.Trakt.Should().Be(12601U); items[1].Movie.Ids.Slug.Should().Be("tron-legacy-2010"); items[1].Movie.Ids.Imdb.Should().Be("tt1104001"); items[1].Movie.Ids.Tmdb.Should().Be(20526U); } }
public async Task Test_SharingArrayJsonReader_ReadArray_From_Stream_Complete() { var jsonReader = new ArrayJsonReader <ITraktSharing>(); using (var stream = JSON_COMPLETE.ToStream()) { IEnumerable <ITraktSharing> traktSharings = await jsonReader.ReadArrayAsync(stream); traktSharings.Should().NotBeNull(); ITraktSharing[] sharings = traktSharings.ToArray(); sharings[0].Should().NotBeNull(); sharings[0].Twitter.Should().BeTrue(); sharings[0].Google.Should().BeTrue(); sharings[0].Tumblr.Should().BeTrue(); sharings[0].Medium.Should().BeTrue(); sharings[0].Slack.Should().BeTrue(); sharings[1].Should().NotBeNull(); sharings[1].Twitter.Should().BeTrue(); sharings[1].Google.Should().BeTrue(); sharings[1].Tumblr.Should().BeTrue(); sharings[1].Medium.Should().BeTrue(); sharings[1].Slack.Should().BeTrue(); } }
public async Task Test_PostResponseNotFoundShowArrayJsonReader_ReadArray_From_Stream_Complete() { var jsonReader = new PostResponseNotFoundShowArrayJsonReader(); using (var stream = JSON_COMPLETE.ToStream()) { var notFoundShows = await jsonReader.ReadArrayAsync(stream); notFoundShows.Should().NotBeNull().And.NotBeEmpty().And.HaveCount(2); var notFoundShow = notFoundShows.ToArray(); notFoundShow[0].Should().NotBeNull(); notFoundShow[0].Ids.Should().NotBeNull(); notFoundShow[0].Ids.Trakt.Should().Be(1390U); notFoundShow[0].Ids.Slug.Should().Be("game-of-thrones"); notFoundShow[0].Ids.Tvdb.Should().Be(121361U); notFoundShow[0].Ids.Imdb.Should().Be("tt0944947"); notFoundShow[0].Ids.Tmdb.Should().Be(1399U); notFoundShow[0].Ids.TvRage.Should().Be(24493U); notFoundShow[1].Should().NotBeNull(); notFoundShow[1].Ids.Should().NotBeNull(); notFoundShow[1].Ids.Trakt.Should().Be(60300U); notFoundShow[1].Ids.Slug.Should().Be("the-flash-2014"); notFoundShow[1].Ids.Tvdb.Should().Be(279121U); notFoundShow[1].Ids.Imdb.Should().Be("tt3107288"); notFoundShow[1].Ids.Tmdb.Should().Be(60735U); notFoundShow[1].Ids.TvRage.Should().Be(36939U); } }
public async Task Test_AuthorizationArrayJsonReader_ReadObject_From_Stream_Complete() { var objectJsonReader = new AuthorizationArrayJsonReader { CompleteDeserialization = true }; using (var stream = JSON_COMPLETE.ToStream()) { IEnumerable <ITraktAuthorization> traktAuthorizations = await objectJsonReader.ReadArrayAsync(stream); traktAuthorizations.Should().NotBeNull(); ITraktAuthorization[] items = traktAuthorizations.ToArray(); items[0].Should().NotBeNull(); items[0].AccessToken.Should().Be("mockAccessToken1"); items[0].RefreshToken.Should().Be("mockRefreshToken1"); items[0].Scope.Should().Be(TraktAccessScope.Public); items[0].ExpiresInSeconds.Should().Be(7200U); items[0].TokenType.Should().Be(TraktAccessTokenType.Bearer); items[0].CreatedAtTimestamp.Should().Be(1506271312UL); items[0].IgnoreExpiration.Should().BeTrue(); items[1].Should().NotBeNull(); items[1].AccessToken.Should().Be("mockAccessToken2"); items[1].RefreshToken.Should().Be("mockRefreshToken2"); items[1].Scope.Should().Be(TraktAccessScope.Public); items[1].ExpiresInSeconds.Should().Be(7200U); items[1].TokenType.Should().Be(TraktAccessTokenType.Bearer); items[1].CreatedAtTimestamp.Should().Be(1506271312UL); items[1].IgnoreExpiration.Should().BeTrue(); } }
public async Task Test_PostResponseNotFoundSeasonArrayJsonReader_ReadArray_From_Stream_Complete() { var jsonReader = new ArrayJsonReader <ITraktPostResponseNotFoundSeason>(); using (var stream = JSON_COMPLETE.ToStream()) { var notFoundSeasons = await jsonReader.ReadArrayAsync(stream); notFoundSeasons.Should().NotBeNull().And.NotBeEmpty().And.HaveCount(2); var notFoundSeason = notFoundSeasons.ToArray(); notFoundSeason[0].Should().NotBeNull(); notFoundSeason[0].Ids.Should().NotBeNull(); notFoundSeason[0].Ids.Trakt.Should().Be(61430U); notFoundSeason[0].Ids.Tvdb.Should().Be(279121U); notFoundSeason[0].Ids.Tmdb.Should().Be(60523U); notFoundSeason[0].Ids.TvRage.Should().Be(36939U); notFoundSeason[1].Should().NotBeNull(); notFoundSeason[1].Ids.Should().NotBeNull(); notFoundSeason[1].Ids.Trakt.Should().Be(61431U); notFoundSeason[1].Ids.Tvdb.Should().Be(578373U); notFoundSeason[1].Ids.Tmdb.Should().Be(60524U); notFoundSeason[1].Ids.TvRage.Should().Be(36940U); } }
public async Task Test_MovieCheckinPostResponseObjectJsonReader_ReadObject_From_Stream_Complete() { var jsonReader = new MovieCheckinPostResponseObjectJsonReader(); using (var stream = JSON_COMPLETE.ToStream()) { var checkinMovieResponse = await jsonReader.ReadObjectAsync(stream); checkinMovieResponse.Should().NotBeNull(); checkinMovieResponse.Id.Should().Be(3373536620UL); checkinMovieResponse.WatchedAt.Should().Be(DateTime.Parse("2014-08-06T06:54:36.859Z").ToUniversalTime()); checkinMovieResponse.Sharing.Should().NotBeNull(); checkinMovieResponse.Sharing.Twitter.Should().BeTrue(); checkinMovieResponse.Sharing.Google.Should().BeTrue(); checkinMovieResponse.Sharing.Tumblr.Should().BeTrue(); checkinMovieResponse.Sharing.Medium.Should().BeTrue(); checkinMovieResponse.Sharing.Slack.Should().BeTrue(); checkinMovieResponse.Movie.Should().NotBeNull(); checkinMovieResponse.Movie.Title.Should().Be("Star Wars: The Force Awakens"); checkinMovieResponse.Movie.Year.Should().Be(2015); checkinMovieResponse.Movie.Ids.Should().NotBeNull(); checkinMovieResponse.Movie.Ids.Trakt.Should().Be(94024U); checkinMovieResponse.Movie.Ids.Slug.Should().Be("star-wars-the-force-awakens-2015"); checkinMovieResponse.Movie.Ids.Imdb.Should().Be("tt2488496"); checkinMovieResponse.Movie.Ids.Tmdb.Should().Be(140607U); } }
public async Task Test_RatingObjectJsonReader_ReadObject_From_Stream_Complete() { var traktJsonReader = new RatingObjectJsonReader(); using (var stream = JSON_COMPLETE.ToStream()) { var traktRating = await traktJsonReader.ReadObjectAsync(stream); traktRating.Should().NotBeNull(); traktRating.Rating.Should().Be(8.32715f); traktRating.Votes.Should().Be(9274); traktRating.Distribution.Should().NotBeNull(); traktRating.Distribution.Should().NotBeEmpty(); traktRating.Distribution.Should().HaveCount(10); traktRating.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 }); } }
public async Task Test_UserCustomListsReorderPostResponseArrayJsonReader_ReadArray_From_Stream_Complete() { var traktJsonReader = new UserCustomListsReorderPostResponseArrayJsonReader(); using (var stream = JSON_COMPLETE.ToStream()) { IEnumerable <ITraktUserCustomListsReorderPostResponse> traktUserCustomListsReorderPostResponses = await traktJsonReader.ReadArrayAsync(stream); traktUserCustomListsReorderPostResponses.Should().NotBeNull(); ITraktUserCustomListsReorderPostResponse[] userCustomListsReorderPosts = traktUserCustomListsReorderPostResponses.ToArray(); userCustomListsReorderPosts[0].Should().NotBeNull(); userCustomListsReorderPosts[0].Updated.Should().Be(6); userCustomListsReorderPosts[0].SkippedIds.Should().NotBeNull().And.HaveCount(1); userCustomListsReorderPosts[0].SkippedIds.Should().BeEquivalentTo(new List <uint> { 2 }); userCustomListsReorderPosts[1].Should().NotBeNull(); userCustomListsReorderPosts[1].Updated.Should().Be(6); userCustomListsReorderPosts[1].SkippedIds.Should().NotBeNull().And.HaveCount(1); userCustomListsReorderPosts[1].SkippedIds.Should().BeEquivalentTo(new List <uint> { 2 }); } }
public async Task Test_CollectionMovieObjectJsonReader_ReadObject_From_Stream_Complete() { var jsonReader = new CollectionMovieObjectJsonReader(); using (var stream = JSON_COMPLETE.ToStream()) { var traktCollectionMovie = await jsonReader.ReadObjectAsync(stream); traktCollectionMovie.Should().NotBeNull(); traktCollectionMovie.CollectedAt.Should().Be(DateTime.Parse("2014-09-01T09:10:11.000Z").ToUniversalTime()); traktCollectionMovie.Movie.Should().NotBeNull(); traktCollectionMovie.Movie.Title.Should().Be("Star Wars: The Force Awakens"); traktCollectionMovie.Movie.Year.Should().Be(2015); traktCollectionMovie.Movie.Ids.Should().NotBeNull(); traktCollectionMovie.Movie.Ids.Trakt.Should().Be(94024U); traktCollectionMovie.Movie.Ids.Slug.Should().Be("star-wars-the-force-awakens-2015"); traktCollectionMovie.Movie.Ids.Imdb.Should().Be("tt2488496"); traktCollectionMovie.Movie.Ids.Tmdb.Should().Be(140607U); traktCollectionMovie.Metadata.Should().NotBeNull(); traktCollectionMovie.Metadata.MediaType.Should().Be(TraktMediaType.Bluray); traktCollectionMovie.Metadata.MediaResolution.Should().Be(TraktMediaResolution.HD_1080p); traktCollectionMovie.Metadata.Audio.Should().Be(TraktMediaAudio.DTS); traktCollectionMovie.Metadata.AudioChannels.Should().Be(TraktMediaAudioChannel.Channels_6_1); traktCollectionMovie.Metadata.ThreeDimensional.Should().BeFalse(); } }
public async Task Test_EpisodeTranslationArrayJsonReader_ReadArray_From_Stream_Complete() { var traktJsonReader = new ArrayJsonReader <ITraktEpisodeTranslation>(); using (var stream = JSON_COMPLETE.ToStream()) { var traktEpisodeTranslations = await traktJsonReader.ReadArrayAsync(stream); traktEpisodeTranslations.Should().NotBeNull().And.NotBeEmpty().And.HaveCount(3); var translations = traktEpisodeTranslations.ToArray(); translations[0].Title.Should().Be("Translation 1"); translations[0].Overview.Should().Be("Translation Overview 1"); translations[0].LanguageCode.Should().Be("Translation Language 1"); translations[1].Title.Should().Be("Translation 2"); translations[1].Overview.Should().Be("Translation Overview 2"); translations[1].LanguageCode.Should().Be("Translation Language 2"); translations[2].Title.Should().Be("Translation 3"); translations[2].Overview.Should().Be("Translation Overview 3"); translations[2].LanguageCode.Should().Be("Translation Language 3"); } }
public async Task Test_CollectionShowSeasonObjectJsonReader_ReadObject_From_Stream_Complete() { var jsonReader = new CollectionShowSeasonObjectJsonReader(); using (var stream = JSON_COMPLETE.ToStream()) { var traktCollectionShowSeason = await jsonReader.ReadObjectAsync(stream); traktCollectionShowSeason.Should().NotBeNull(); traktCollectionShowSeason.Number.Should().Be(1); traktCollectionShowSeason.Episodes.Should().NotBeNull().And.NotBeEmpty().And.HaveCount(2); var traktCollectionShowSeasonEpisodes = traktCollectionShowSeason.Episodes.ToArray(); traktCollectionShowSeasonEpisodes[0].Number.Should().Be(1); traktCollectionShowSeasonEpisodes[0].CollectedAt.Should().Be(DateTime.Parse("2014-07-14T01:00:00.000Z").ToUniversalTime()); traktCollectionShowSeasonEpisodes[0].Metadata.Should().NotBeNull(); traktCollectionShowSeasonEpisodes[0].Metadata.MediaType.Should().Be(TraktMediaType.Digital); traktCollectionShowSeasonEpisodes[0].Metadata.MediaResolution.Should().Be(TraktMediaResolution.HD_720p); traktCollectionShowSeasonEpisodes[0].Metadata.Audio.Should().Be(TraktMediaAudio.AAC); traktCollectionShowSeasonEpisodes[0].Metadata.AudioChannels.Should().Be(TraktMediaAudioChannel.Channels_5_1); traktCollectionShowSeasonEpisodes[0].Metadata.ThreeDimensional.Should().BeTrue(); traktCollectionShowSeasonEpisodes[1].Number.Should().Be(2); traktCollectionShowSeasonEpisodes[1].CollectedAt.Should().Be(DateTime.Parse("2014-07-15T01:00:00.000Z").ToUniversalTime()); traktCollectionShowSeasonEpisodes[1].Metadata.Should().NotBeNull(); traktCollectionShowSeasonEpisodes[1].Metadata.MediaType.Should().Be(TraktMediaType.Digital); traktCollectionShowSeasonEpisodes[1].Metadata.MediaResolution.Should().Be(TraktMediaResolution.HD_720p); traktCollectionShowSeasonEpisodes[1].Metadata.Audio.Should().Be(TraktMediaAudio.AAC); traktCollectionShowSeasonEpisodes[1].Metadata.AudioChannels.Should().Be(TraktMediaAudioChannel.Channels_5_1); traktCollectionShowSeasonEpisodes[1].Metadata.ThreeDimensional.Should().BeFalse(); } }
public async Task Test_PostResponseNotFoundPersonArrayJsonReader_ReadArray_From_Stream_Complete() { var jsonReader = new PostResponseNotFoundPersonArrayJsonReader(); using (var stream = JSON_COMPLETE.ToStream()) { var notFoundPersons = await jsonReader.ReadArrayAsync(stream); notFoundPersons.Should().NotBeNull().And.NotBeEmpty().And.HaveCount(2); var notFoundPerson = notFoundPersons.ToArray(); notFoundPerson[0].Should().NotBeNull(); notFoundPerson[0].Ids.Should().NotBeNull(); notFoundPerson[0].Ids.Trakt.Should().Be(297737U); notFoundPerson[0].Ids.Slug.Should().Be("bryan-cranston"); notFoundPerson[0].Ids.Imdb.Should().Be("nm0186505"); notFoundPerson[0].Ids.Tmdb.Should().Be(17419U); notFoundPerson[0].Ids.TvRage.Should().Be(1797U); notFoundPerson[1].Should().NotBeNull(); notFoundPerson[1].Ids.Should().NotBeNull(); notFoundPerson[1].Ids.Trakt.Should().Be(9486U); notFoundPerson[1].Ids.Slug.Should().Be("samuel-l-jackson"); notFoundPerson[1].Ids.Imdb.Should().Be("nm0000168"); notFoundPerson[1].Ids.Tmdb.Should().Be(2231U); notFoundPerson[1].Ids.TvRage.Should().Be(55720U); } }