public async Task Test_PostResponseNotFoundEpisodeArrayJsonReader_ReadArray_From_Json_String_Complete() { var jsonReader = new PostResponseNotFoundEpisodeArrayJsonReader(); var notFoundEpisodes = await jsonReader.ReadArrayAsync(JSON_COMPLETE); 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_PostResponseNotFoundEpisodeArrayJsonReader_ReadArray_From_JsonReader_Not_Valid() { var traktJsonReader = new PostResponseNotFoundEpisodeArrayJsonReader(); using (var reader = new StringReader(JSON_NOT_VALID)) using (var jsonReader = new JsonTextReader(reader)) { var notFoundEpisodes = await traktJsonReader.ReadArrayAsync(jsonReader); 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().BeNull(); } }
public override async Task <ITraktUserCustomListItemsPostResponseNotFoundGroup> ReadObjectAsync(JsonTextReader jsonReader, CancellationToken cancellationToken = default) { if (jsonReader == null) { return(await Task.FromResult(default(ITraktUserCustomListItemsPostResponseNotFoundGroup))); } if (await jsonReader.ReadAsync(cancellationToken) && jsonReader.TokenType == JsonToken.StartObject) { var notFoundMoviesReader = new PostResponseNotFoundMovieArrayJsonReader(); var notFoundShowsReader = new PostResponseNotFoundShowArrayJsonReader(); var notFoundSeasonsReader = new PostResponseNotFoundSeasonArrayJsonReader(); var notFoundEpisodesReader = new PostResponseNotFoundEpisodeArrayJsonReader(); var notFoundPeopleReader = new PostResponseNotFoundPersonArrayJsonReader(); ITraktUserCustomListItemsPostResponseNotFoundGroup customListItemsPostResponseNotFoundGroup = new TraktUserCustomListItemsPostResponseNotFoundGroup(); while (await jsonReader.ReadAsync(cancellationToken) && jsonReader.TokenType == JsonToken.PropertyName) { var propertyName = jsonReader.Value.ToString(); switch (propertyName) { case JsonProperties.USER_CUSTOM_LIST_ITEMS_POST_RESPONSE_NOT_FOUND_GROUP_PROPERTY_NAME_MOVIES: customListItemsPostResponseNotFoundGroup.Movies = await notFoundMoviesReader.ReadArrayAsync(jsonReader, cancellationToken); break; case JsonProperties.USER_CUSTOM_LIST_ITEMS_POST_RESPONSE_NOT_FOUND_GROUP_PROPERTY_NAME_SHOWS: customListItemsPostResponseNotFoundGroup.Shows = await notFoundShowsReader.ReadArrayAsync(jsonReader, cancellationToken); break; case JsonProperties.USER_CUSTOM_LIST_ITEMS_POST_RESPONSE_NOT_FOUND_GROUP_PROPERTY_NAME_SEASONS: customListItemsPostResponseNotFoundGroup.Seasons = await notFoundSeasonsReader.ReadArrayAsync(jsonReader, cancellationToken); break; case JsonProperties.USER_CUSTOM_LIST_ITEMS_POST_RESPONSE_NOT_FOUND_GROUP_PROPERTY_NAME_EPISODES: customListItemsPostResponseNotFoundGroup.Episodes = await notFoundEpisodesReader.ReadArrayAsync(jsonReader, cancellationToken); break; case JsonProperties.USER_CUSTOM_LIST_ITEMS_POST_RESPONSE_NOT_FOUND_GROUP_PROPERTY_NAME_PEOPLE: customListItemsPostResponseNotFoundGroup.People = await notFoundPeopleReader.ReadArrayAsync(jsonReader, cancellationToken); break; default: await JsonReaderHelper.ReadAndIgnoreInvalidContentAsync(jsonReader, cancellationToken); break; } } return(customListItemsPostResponseNotFoundGroup); } return(await Task.FromResult(default(ITraktUserCustomListItemsPostResponseNotFoundGroup))); }
public async Task Test_PostResponseNotFoundEpisodeArrayJsonReader_ReadArray_From_Json_String_Empty() { var jsonReader = new PostResponseNotFoundEpisodeArrayJsonReader(); var notFoundEpisodes = await jsonReader.ReadArrayAsync(string.Empty); notFoundEpisodes.Should().BeNull(); }
public async Task Test_PostResponseNotFoundEpisodeArrayJsonReader_ReadArray_From_Json_String_Empty_Array() { var jsonReader = new PostResponseNotFoundEpisodeArrayJsonReader(); var notFoundEpisodes = await jsonReader.ReadArrayAsync(JSON_EMPTY_ARRAY); notFoundEpisodes.Should().NotBeNull().And.BeEmpty(); }
public async Task Test_PostResponseNotFoundEpisodeArrayJsonReader_ReadArray_From_JsonReader_Null() { var traktJsonReader = new PostResponseNotFoundEpisodeArrayJsonReader(); var notFoundEpisodes = await traktJsonReader.ReadArrayAsync(default(JsonTextReader)); notFoundEpisodes.Should().BeNull(); }
public async Task Test_PostResponseNotFoundEpisodeArrayJsonReader_ReadArray_From_Stream_Null() { var jsonReader = new PostResponseNotFoundEpisodeArrayJsonReader(); var notFoundEpisodes = await jsonReader.ReadArrayAsync(default(Stream)); notFoundEpisodes.Should().BeNull(); }
public override async Task <ITraktSyncHistoryRemovePostResponseNotFoundGroup> ReadObjectAsync(JsonTextReader jsonReader, CancellationToken cancellationToken = default) { if (jsonReader == null) { return(await Task.FromResult(default(ITraktSyncHistoryRemovePostResponseNotFoundGroup))); } if (await jsonReader.ReadAsync(cancellationToken) && jsonReader.TokenType == JsonToken.StartObject) { var notFoundMoviesReader = new PostResponseNotFoundMovieArrayJsonReader(); var notFoundShowsReader = new PostResponseNotFoundShowArrayJsonReader(); var notFoundSeasonsReader = new PostResponseNotFoundSeasonArrayJsonReader(); var notFoundEpisodesReader = new PostResponseNotFoundEpisodeArrayJsonReader(); ITraktSyncHistoryRemovePostResponseNotFoundGroup syncHistoryRemovePostResponseNotFoundGroup = new TraktSyncHistoryRemovePostResponseNotFoundGroup(); while (await jsonReader.ReadAsync(cancellationToken) && jsonReader.TokenType == JsonToken.PropertyName) { var propertyName = jsonReader.Value.ToString(); switch (propertyName) { case JsonProperties.SYNC_POST_RESPONSE_NOT_FOUND_GROUP_PROPERTY_NAME_MOVIES: syncHistoryRemovePostResponseNotFoundGroup.Movies = await notFoundMoviesReader.ReadArrayAsync(jsonReader, cancellationToken); break; case JsonProperties.SYNC_POST_RESPONSE_NOT_FOUND_GROUP_PROPERTY_NAME_SHOWS: syncHistoryRemovePostResponseNotFoundGroup.Shows = await notFoundShowsReader.ReadArrayAsync(jsonReader, cancellationToken); break; case JsonProperties.SYNC_POST_RESPONSE_NOT_FOUND_GROUP_PROPERTY_NAME_SEASONS: syncHistoryRemovePostResponseNotFoundGroup.Seasons = await notFoundSeasonsReader.ReadArrayAsync(jsonReader, cancellationToken); break; case JsonProperties.SYNC_POST_RESPONSE_NOT_FOUND_GROUP_PROPERTY_NAME_EPISODES: syncHistoryRemovePostResponseNotFoundGroup.Episodes = await notFoundEpisodesReader.ReadArrayAsync(jsonReader, cancellationToken); break; case JsonProperties.SYNC_HISTORY_REMOVE_POST_RESPONSE_NOT_FOUND_GROUP_PROPERTY_NAME_IDS: syncHistoryRemovePostResponseNotFoundGroup.HistoryIds = await JsonReaderHelper.ReadUnsignedLongArrayAsync(jsonReader, cancellationToken); break; default: await JsonReaderHelper.ReadAndIgnoreInvalidContentAsync(jsonReader, cancellationToken); break; } } return(syncHistoryRemovePostResponseNotFoundGroup); } return(await Task.FromResult(default(ITraktSyncHistoryRemovePostResponseNotFoundGroup))); }
public async Task Test_PostResponseNotFoundEpisodeArrayJsonReader_ReadArray_From_Stream_Empty() { var jsonReader = new PostResponseNotFoundEpisodeArrayJsonReader(); using (var stream = string.Empty.ToStream()) { var notFoundEpisodes = await jsonReader.ReadArrayAsync(stream); notFoundEpisodes.Should().BeNull(); } }
public async Task Test_PostResponseNotFoundEpisodeArrayJsonReader_ReadArray_From_Stream_Empty_Array() { var jsonReader = new PostResponseNotFoundEpisodeArrayJsonReader(); using (var stream = JSON_EMPTY_ARRAY.ToStream()) { var notFoundEpisodes = await jsonReader.ReadArrayAsync(stream); notFoundEpisodes.Should().NotBeNull().And.BeEmpty(); } }
public async Task Test_PostResponseNotFoundEpisodeArrayJsonReader_ReadArray_From_JsonReader_Empty() { var traktJsonReader = new PostResponseNotFoundEpisodeArrayJsonReader(); using (var reader = new StringReader(string.Empty)) using (var jsonReader = new JsonTextReader(reader)) { var notFoundEpisodes = await traktJsonReader.ReadArrayAsync(jsonReader); notFoundEpisodes.Should().BeNull(); } }