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_PostResponseNotFoundShowArrayJsonReader_ReadArray_From_Stream_Not_Valid() { var jsonReader = new PostResponseNotFoundShowArrayJsonReader(); using (var stream = JSON_NOT_VALID.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().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_PostResponseNotFoundShowArrayJsonReader_ReadArray_From_Stream_Null() { var jsonReader = new PostResponseNotFoundShowArrayJsonReader(); var traktShowCollectionProgress = await jsonReader.ReadArrayAsync(default(Stream)); traktShowCollectionProgress.Should().BeNull(); }
public async Task Test_PostResponseNotFoundShowArrayJsonReader_ReadArray_From_Json_String_Empty() { var jsonReader = new PostResponseNotFoundShowArrayJsonReader(); var notFoundShows = await jsonReader.ReadArrayAsync(string.Empty); notFoundShows.Should().BeNull(); }
public async Task Test_PostResponseNotFoundShowArrayJsonReader_ReadArray_From_Json_String_Empty_Array() { var jsonReader = new PostResponseNotFoundShowArrayJsonReader(); var notFoundShows = await jsonReader.ReadArrayAsync(JSON_EMPTY_ARRAY); notFoundShows.Should().NotBeNull().And.BeEmpty(); }
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_PostResponseNotFoundShowArrayJsonReader_ReadArray_From_Stream_Empty() { var jsonReader = new PostResponseNotFoundShowArrayJsonReader(); using (var stream = string.Empty.ToStream()) { var traktShowCollectionProgress = await jsonReader.ReadArrayAsync(stream); traktShowCollectionProgress.Should().BeNull(); } }
public async Task Test_PostResponseNotFoundShowArrayJsonReader_ReadArray_From_Stream_Empty_Array() { var jsonReader = new PostResponseNotFoundShowArrayJsonReader(); using (var stream = JSON_EMPTY_ARRAY.ToStream()) { var notFoundShows = await jsonReader.ReadArrayAsync(stream); notFoundShows.Should().NotBeNull().And.BeEmpty(); } }
public async Task Test_PostResponseNotFoundShowArrayJsonReader_ReadArray_From_JsonReader_Empty_Array() { var traktJsonReader = new PostResponseNotFoundShowArrayJsonReader(); using (var reader = new StringReader(JSON_EMPTY_ARRAY)) using (var jsonReader = new JsonTextReader(reader)) { var notFoundShows = await traktJsonReader.ReadArrayAsync(jsonReader); notFoundShows.Should().NotBeNull().And.BeEmpty(); } }
public async Task Test_PostResponseNotFoundShowArrayJsonReader_ReadArray_From_JsonReader_Empty() { var traktJsonReader = new PostResponseNotFoundShowArrayJsonReader(); using (var reader = new StringReader(string.Empty)) using (var jsonReader = new JsonTextReader(reader)) { var traktShowCollectionProgress = await traktJsonReader.ReadArrayAsync(jsonReader); traktShowCollectionProgress.Should().BeNull(); } }