public async Task Test_AuthorizationArrayJsonReader_ReadObject_From_Stream_Incomplete_1() { var objectJsonReader = new AuthorizationArrayJsonReader { CompleteDeserialization = true }; using (var stream = JSON_INCOMPLETE_1.ToStream()) { IEnumerable <ITraktAuthorization> traktAuthorizations = await objectJsonReader.ReadArrayAsync(stream); traktAuthorizations.Should().NotBeNull(); ITraktAuthorization[] items = traktAuthorizations.ToArray(); items[0].Should().NotBeNull(); items[0].AccessToken.Should().BeNull(); 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_MovieCheckinPostResponseObjectJsonReader_ReadObject_From_Stream_Incomplete_1() { var jsonReader = new MovieCheckinPostResponseObjectJsonReader(); using (var stream = JSON_INCOMPLETE_1.ToStream()) { var checkinMovieResponse = await jsonReader.ReadObjectAsync(stream); checkinMovieResponse.Should().NotBeNull(); checkinMovieResponse.Id.Should().Be(0UL); 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_UserFollowRequestObjectJsonReader_ReadObject_From_Stream_Incomplete_1() { var jsonReader = new UserFollowRequestObjectJsonReader(); using (var stream = JSON_INCOMPLETE_1.ToStream()) { var userFollowRequest = await jsonReader.ReadObjectAsync(stream); userFollowRequest.Should().NotBeNull(); userFollowRequest.Id.Should().Be(0U); 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_SharingArrayJsonReader_ReadArray_From_Stream_Incomplete_1() { var jsonReader = new ArrayJsonReader <ITraktSharing>(); using (var stream = JSON_INCOMPLETE_1.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().BeNull(); sharings[1].Google.Should().BeTrue(); sharings[1].Tumblr.Should().BeTrue(); sharings[1].Medium.Should().BeTrue(); sharings[1].Slack.Should().BeTrue(); } }
public async Task Test_CrewMemberArrayJsonReader_ReadObject_From_Stream_Incomplete_1() { var jsonReader = new CrewMemberArrayJsonReader(); using (var stream = JSON_INCOMPLETE_1.ToStream()) { var traktCrewMembers = await jsonReader.ReadArrayAsync(stream); traktCrewMembers.Should().NotBeNull(); var items = traktCrewMembers.ToArray(); items[0].Should().NotBeNull(); items[0].Job.Should().BeNull(); 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_CommentLikeArrayJsonReader_ReadArray_From_Stream_Incomplete_1() { var jsonReader = new ArrayJsonReader <ITraktCommentLike>(); using (var stream = JSON_INCOMPLETE_1.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().BeNull(); } }
public async Task Test_MostPWCShowObjectJsonReader_ReadObject_From_Stream_Incomplete_1() { var traktJsonReader = new MostPWCShowObjectJsonReader(); using (var stream = JSON_INCOMPLETE_1.ToStream()) { var traktMostPWCShow = await traktJsonReader.ReadObjectAsync(stream); traktMostPWCShow.Should().NotBeNull(); traktMostPWCShow.WatcherCount.Should().BeNull(); 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_WatchedShowEpisodeArrayJsonReader_ReadArray_From_Stream_Incomplete_1() { var jsonReader = new ArrayJsonReader <ITraktWatchedShowEpisode>(); using (var stream = JSON_INCOMPLETE_1.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().BeNull(); 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_CalendarShowObjectJsonReader_ReadObject_From_Stream_Incomplete_1() { var jsonReader = new CalendarShowObjectJsonReader(); using (var stream = JSON_INCOMPLETE_1.ToStream()) { var traktCalendarShow = await jsonReader.ReadObjectAsync(stream); traktCalendarShow.Should().NotBeNull(); traktCalendarShow.FirstAiredInCalendar.Should().BeNull(); 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_MovieScrobblePostResponseObjectJsonReader_ReadObject_From_Stream_Incomplete_1() { var jsonReader = new MovieScrobblePostResponseObjectJsonReader(); using (var stream = JSON_INCOMPLETE_1.ToStream()) { var movieScrobbleResponse = await jsonReader.ReadObjectAsync(stream); movieScrobbleResponse.Should().NotBeNull(); movieScrobbleResponse.Id.Should().Be(0UL); 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_UserSettingsObjectJsonReader_ReadObject_From_Stream_Incomplete_1() { var jsonReader = new UserSettingsObjectJsonReader(); using (var stream = JSON_INCOMPLETE_1.ToStream()) { var userSettings = await jsonReader.ReadObjectAsync(stream); userSettings.Should().NotBeNull(); userSettings.User.Should().BeNull(); userSettings.Account.Should().NotBeNull(); userSettings.Account.TimeZoneId.Should().Be("America/Los_Angeles"); userSettings.Account.Time24Hr.Should().BeTrue(); userSettings.Account.CoverImage.Should().Be("https://walter.trakt.us/images/movies/000/001/545/fanarts/original/0abb604492.jpg?1406095042"); userSettings.Account.Token.Should().Be("60fa34c4f5e7f093ecc5a2d16d691e24"); userSettings.Connections.Should().NotBeNull(); userSettings.Connections.Twitter.Should().BeTrue(); userSettings.Connections.Google.Should().BeTrue(); userSettings.Connections.Tumblr.Should().BeTrue(); userSettings.Connections.Medium.Should().BeTrue(); userSettings.Connections.Slack.Should().BeTrue(); userSettings.SharingText.Should().NotBeNull(); userSettings.SharingText.Watching.Should().Be("I'm watching [item]"); userSettings.SharingText.Watched.Should().Be("I just watched [item]"); } }
public async Task Test_UserCustomListsReorderPostResponseArrayJsonReader_ReadArray_From_Stream_Incomplete_1() { var traktJsonReader = new UserCustomListsReorderPostResponseArrayJsonReader(); using (var stream = JSON_INCOMPLETE_1.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().BeNull(); userCustomListsReorderPosts[1].SkippedIds.Should().NotBeNull().And.HaveCount(1); userCustomListsReorderPosts[1].SkippedIds.Should().BeEquivalentTo(new List <uint> { 2 }); } }
public async Task Test_EpisodeTranslationArrayJsonReader_ReadArray_From_Stream_Incomplete_1() { var traktJsonReader = new ArrayJsonReader <ITraktEpisodeTranslation>(); using (var stream = JSON_INCOMPLETE_1.ToStream()) { var traktEpisodeTranslations = await traktJsonReader.ReadArrayAsync(stream); traktEpisodeTranslations.Should().NotBeNull().And.NotBeEmpty().And.HaveCount(3); var translations = traktEpisodeTranslations.ToArray(); translations[0].Title.Should().BeNull(); 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_Incomplete_1() { var jsonReader = new CollectionShowSeasonObjectJsonReader(); using (var stream = JSON_INCOMPLETE_1.ToStream()) { var traktCollectionShowSeason = await jsonReader.ReadObjectAsync(stream); traktCollectionShowSeason.Should().NotBeNull(); traktCollectionShowSeason.Number.Should().BeNull(); 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_IdsArrayJsonReader_ReadArray_From_Stream_Incomplete_1() { var jsonReader = new ArrayJsonReader <ITraktIds>(); using (var stream = JSON_INCOMPLETE_1.ToStream()) { IEnumerable <ITraktIds> multipleTraktIds = await jsonReader.ReadArrayAsync(stream); multipleTraktIds.Should().NotBeNull(); ITraktIds[] ids = multipleTraktIds.ToArray(); ids[0].Should().NotBeNull(); ids[0].Trakt.Should().Be(1390); ids[0].Slug.Should().Be("game-of-thrones"); ids[0].Tvdb.Should().Be(121361U); ids[0].Imdb.Should().Be("tt0944947"); ids[0].Tmdb.Should().Be(1399U); ids[0].TvRage.Should().Be(24493U); ids[1].Should().NotBeNull(); ids[1].Trakt.Should().Be(0); ids[1].Slug.Should().Be("game-of-thrones"); ids[1].Tvdb.Should().Be(121361U); ids[1].Imdb.Should().Be("tt0944947"); ids[1].Tmdb.Should().Be(1399U); ids[1].TvRage.Should().Be(24493U); } }
public async Task Test_CastMemberArrayJsonReader_ReadObject_From_Stream_Incomplete_1() { var jsonReader = new ArrayJsonReader <ITraktCastMember>(); using (var stream = JSON_INCOMPLETE_1.ToStream()) { var traktCastMembers = await jsonReader.ReadArrayAsync(stream); traktCastMembers.Should().NotBeNull(); var items = traktCastMembers.ToArray(); items[0].Should().NotBeNull(); items[0].Characters.Should().BeNull(); 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_CastAndCrewArrayJsonReader_ReadArray_From_Stream_Incomplete_1() { var jsonReader = new ArrayJsonReader <ITraktCastAndCrew>(); using (var stream = JSON_INCOMPLETE_1.ToStream()) { IEnumerable <ITraktCastAndCrew> traktCastAndCrews = await jsonReader.ReadArrayAsync(stream); traktCastAndCrews.Should().NotBeNull(); ITraktCastAndCrew[] items = traktCastAndCrews.ToArray(); ITraktCastMember[] castMemberItems = items[0].Cast.ToArray(); castMemberItems[0].Should().NotBeNull(); castMemberItems[0].Characters.Should().NotBeNull().And.HaveCount(1).And.Contain("Joe Brody"); castMemberItems[0].Person.Should().NotBeNull(); castMemberItems[0].Person.Name.Should().Be("Bryan Cranston"); castMemberItems[0].Person.Ids.Should().NotBeNull(); castMemberItems[0].Person.Ids.Trakt.Should().Be(297737U); castMemberItems[0].Person.Ids.Slug.Should().Be("bryan-cranston"); castMemberItems[0].Person.Ids.Imdb.Should().Be("nm0186505"); castMemberItems[0].Person.Ids.Tmdb.Should().Be(17419U); castMemberItems[0].Person.Ids.TvRage.Should().Be(1797U); items[0].Crew.Should().BeNull(); castMemberItems = items[1].Cast.ToArray(); castMemberItems[0].Should().NotBeNull(); castMemberItems[0].Characters.Should().NotBeNull().And.HaveCount(1).And.Contain("Joe Brody"); castMemberItems[0].Person.Should().BeNull(); items[1].Crew.Should().BeNull(); } }
public async Task Test_EpisodeIdsArrayJsonReader_ReadArray_From_Stream_Incomplete_1() { var traktJsonReader = new ArrayJsonReader <ITraktEpisodeIds>(); using (var stream = JSON_INCOMPLETE_1.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(0); 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_CollectionMovieObjectJsonReader_ReadObject_From_Stream_Incomplete_1() { var jsonReader = new CollectionMovieObjectJsonReader(); using (var stream = JSON_INCOMPLETE_1.ToStream()) { var traktCollectionMovie = await jsonReader.ReadObjectAsync(stream); traktCollectionMovie.Should().NotBeNull(); traktCollectionMovie.CollectedAt.Should().BeNull(); 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_EpisodeCollectionProgressArrayJsonReader_ReadArray_From_Stream_Incomplete_1() { var traktJsonReader = new ArrayJsonReader <ITraktEpisodeCollectionProgress>(); using (var stream = JSON_INCOMPLETE_1.ToStream()) { var traktEpisodeCollectionProgresses = await traktJsonReader.ReadArrayAsync(stream); traktEpisodeCollectionProgresses.Should().NotBeNull().And.NotBeEmpty().And.HaveCount(3); var collectionProgress = traktEpisodeCollectionProgresses.ToArray(); collectionProgress[0].Number.Should().BeNull(); 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_RatingObjectJsonReader_ReadObject_From_Stream_Incomplete_1() { var traktJsonReader = new RatingObjectJsonReader(); using (var stream = JSON_INCOMPLETE_1.ToStream()) { var traktRating = await traktJsonReader.ReadObjectAsync(stream); traktRating.Should().NotBeNull(); traktRating.Rating.Should().BeNull(); 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_DeviceArrayJsonReader_ReadObject_From_Stream_Incomplete_1() { var objectJsonReader = new ArrayJsonReader <ITraktDevice>(); using (var stream = JSON_INCOMPLETE_1.ToStream()) { IEnumerable <ITraktDevice> traktDevices = await objectJsonReader.ReadArrayAsync(stream); traktDevices.Should().NotBeNull(); ITraktDevice[] items = traktDevices.ToArray(); items[0].Should().NotBeNull(); items[0].DeviceCode.Should().BeNull(); 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_CalendarMovieArrayJsonReader_ReadArray_From_Stream_Incomplete_1() { var jsonReader = new ArrayJsonReader <ITraktCalendarMovie>(); using (var stream = JSON_INCOMPLETE_1.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().BeNull(); 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_UserRatingsStatisticsObjectJsonReader_ReadObject_From_Stream_Incomplete_1() { var jsonReader = new UserRatingsStatisticsObjectJsonReader(); using (var stream = JSON_INCOMPLETE_1.ToStream()) { var userRatingsStatistics = await jsonReader.ReadObjectAsync(stream); userRatingsStatistics.Should().NotBeNull(); userRatingsStatistics.Total.Should().BeNull(); 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_PersonMovieCreditsCrewItemArrayJsonReader_ReadObject_From_Stream_Incomplete_1() { var jsonReader = new ArrayJsonReader <ITraktPersonMovieCreditsCrewItem>(); using (var stream = JSON_INCOMPLETE_1.ToStream()) { var movieCreditsCrewItems = await jsonReader.ReadArrayAsync(stream); movieCreditsCrewItems.Should().NotBeNull(); var items = movieCreditsCrewItems.ToArray(); items[0].Should().NotBeNull(); items[0].Jobs.Should().BeNull(); 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_MetadataArrayJsonReader_ReadArray_From_Stream_Incomplete_1() { var jsonReader = new ArrayJsonReader <ITraktMetadata>(); using (var stream = JSON_INCOMPLETE_1.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().BeNull(); 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_SeasonWatchedProgressObjectJsonReader_ReadObject_From_Stream_Incomplete_1() { var traktJsonReader = new SeasonWatchedProgressObjectJsonReader(); using (var stream = JSON_INCOMPLETE_1.ToStream()) { var traktSeasonWatchedProgress = await traktJsonReader.ReadObjectAsync(stream); traktSeasonWatchedProgress.Should().NotBeNull(); traktSeasonWatchedProgress.Number.Should().BeNull(); 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_StatisticsArrayJsonReader_ReadArray_From_Stream_Incomplete_1() { var jsonReader = new ArrayJsonReader <ITraktStatistics>(); using (var stream = JSON_INCOMPLETE_1.ToStream()) { IEnumerable <ITraktStatistics> traktStatisticss = await jsonReader.ReadArrayAsync(stream); traktStatisticss.Should().NotBeNull(); ITraktStatistics[] statistics = traktStatisticss.ToArray(); statistics[0].Should().NotBeNull(); statistics[0].Watchers.Should().Be(129920); statistics[0].Plays.Should().Be(3563853); statistics[0].Collectors.Should().Be(49711); statistics[0].CollectedEpisodes.Should().Be(1310350); statistics[0].Comments.Should().Be(96); statistics[0].Lists.Should().Be(49468); statistics[0].Votes.Should().Be(9274); statistics[1].Should().NotBeNull(); statistics[1].Watchers.Should().BeNull(); statistics[1].Plays.Should().Be(3563853); statistics[1].Collectors.Should().Be(49711); statistics[1].CollectedEpisodes.Should().Be(1310350); statistics[1].Comments.Should().Be(96); statistics[1].Lists.Should().Be(49468); statistics[1].Votes.Should().Be(9274); } }
public async Task Test_WatchedShowObjectJsonReader_ReadObject_From_Stream_Incomplete_1() { var jsonReader = new WatchedShowObjectJsonReader(); using (var stream = JSON_INCOMPLETE_1.ToStream()) { var traktWatchedShow = await jsonReader.ReadObjectAsync(stream); traktWatchedShow.Should().NotBeNull(); traktWatchedShow.Plays.Should().BeNull(); traktWatchedShow.LastWatchedAt.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_CalendarShowArrayJsonReader_ReadArray_From_Stream_Incomplete_1() { var jsonReader = new ArrayJsonReader <ITraktCalendarShow>(); using (var stream = JSON_INCOMPLETE_1.ToStream()) { IEnumerable <ITraktCalendarShow> traktCalendarShows = await jsonReader.ReadArrayAsync(stream); traktCalendarShows.Should().NotBeNull(); ITraktCalendarShow[] calendarShows = traktCalendarShows.ToArray(); calendarShows[0].Should().NotBeNull(); calendarShows[0].FirstAiredInCalendar.Should().Be(DateTime.Parse("2014-07-14T01:00:00.000Z").ToUniversalTime()); calendarShows[0].Show.Should().NotBeNull(); calendarShows[0].Show.Title.Should().Be("Game of Thrones"); calendarShows[0].Show.Year.Should().Be(2011); calendarShows[0].Show.Ids.Should().NotBeNull(); calendarShows[0].Show.Ids.Trakt.Should().Be(1390U); calendarShows[0].Show.Ids.Slug.Should().Be("game-of-thrones"); calendarShows[0].Show.Ids.Tvdb.Should().Be(121361U); calendarShows[0].Show.Ids.Imdb.Should().Be("tt0944947"); calendarShows[0].Show.Ids.Tmdb.Should().Be(1399U); calendarShows[0].Show.Ids.TvRage.Should().Be(24493U); calendarShows[0].Episode.Should().NotBeNull(); calendarShows[0].Episode.SeasonNumber.Should().Be(1); calendarShows[0].Episode.Number.Should().Be(1); calendarShows[0].Episode.Title.Should().Be("Winter Is Coming"); calendarShows[0].Episode.Ids.Should().NotBeNull(); calendarShows[0].Episode.Ids.Trakt.Should().Be(73640U); calendarShows[0].Episode.Ids.Tvdb.Should().Be(3254641U); calendarShows[0].Episode.Ids.Imdb.Should().Be("tt1480055"); calendarShows[0].Episode.Ids.Tmdb.Should().Be(63056U); calendarShows[0].Episode.Ids.TvRage.Should().Be(1065008299U); calendarShows[1].Should().NotBeNull(); calendarShows[1].FirstAiredInCalendar.Should().BeNull(); calendarShows[1].Show.Should().NotBeNull(); calendarShows[1].Show.Title.Should().Be("Game of Thrones"); calendarShows[1].Show.Year.Should().Be(2011); calendarShows[1].Show.Ids.Should().NotBeNull(); calendarShows[1].Show.Ids.Trakt.Should().Be(1390U); calendarShows[1].Show.Ids.Slug.Should().Be("game-of-thrones"); calendarShows[1].Show.Ids.Tvdb.Should().Be(121361U); calendarShows[1].Show.Ids.Imdb.Should().Be("tt0944947"); calendarShows[1].Show.Ids.Tmdb.Should().Be(1399U); calendarShows[1].Show.Ids.TvRage.Should().Be(24493U); calendarShows[1].Episode.Should().NotBeNull(); calendarShows[1].Episode.SeasonNumber.Should().Be(1); calendarShows[1].Episode.Number.Should().Be(1); calendarShows[1].Episode.Title.Should().Be("Winter Is Coming"); calendarShows[1].Episode.Ids.Should().NotBeNull(); calendarShows[1].Episode.Ids.Trakt.Should().Be(73640U); calendarShows[1].Episode.Ids.Tvdb.Should().Be(3254641U); calendarShows[1].Episode.Ids.Imdb.Should().Be("tt1480055"); calendarShows[1].Episode.Ids.Tmdb.Should().Be(63056U); calendarShows[1].Episode.Ids.TvRage.Should().Be(1065008299U); } }