public async Task Test_TraktSyncRecommendationsPostResponse_From_Json() { var jsonReader = new SyncRecommendationsPostResponseObjectJsonReader(); var syncRecommendationsPostResponse = await jsonReader.ReadObjectAsync(JSON) as TraktSyncRecommendationsPostResponse; syncRecommendationsPostResponse.Should().NotBeNull(); syncRecommendationsPostResponse.Added.Should().NotBeNull(); syncRecommendationsPostResponse.Added.Movies.Should().Be(1); syncRecommendationsPostResponse.Added.Shows.Should().Be(2); syncRecommendationsPostResponse.Existing.Should().NotBeNull(); syncRecommendationsPostResponse.Existing.Movies.Should().Be(3); syncRecommendationsPostResponse.Existing.Shows.Should().Be(4); syncRecommendationsPostResponse.NotFound.Should().NotBeNull(); syncRecommendationsPostResponse.NotFound.Movies.Should().NotBeNull().And.HaveCount(1); ITraktSyncRecommendationsPostMovie[] notFoundMovies = syncRecommendationsPostResponse.NotFound.Movies.ToArray(); notFoundMovies[0].Should().NotBeNull(); notFoundMovies[0].Ids.Should().NotBeNull(); notFoundMovies[0].Ids.Trakt.Should().Be(0U); notFoundMovies[0].Ids.Slug.Should().BeNull(); notFoundMovies[0].Ids.Imdb.Should().Be("tt0000111"); notFoundMovies[0].Ids.Tmdb.Should().BeNull(); syncRecommendationsPostResponse.NotFound.Shows.Should().NotBeNull().And.HaveCount(1); ITraktSyncRecommendationsPostShow[] notFoundShows = syncRecommendationsPostResponse.NotFound.Shows.ToArray(); notFoundShows[0].Should().NotBeNull(); notFoundShows[0].Ids.Should().NotBeNull(); notFoundShows[0].Ids.Trakt.Should().Be(0U); notFoundShows[0].Ids.Slug.Should().BeNull(); notFoundShows[0].Ids.Imdb.Should().Be("tt0000222"); notFoundShows[0].Ids.Tvdb.Should().BeNull(); notFoundShows[0].Ids.Tmdb.Should().BeNull(); }
public async Task Test_SyncRecommendationsPostResponseObjectJsonReader_ReadObject_From_Stream_Empty() { var traktJsonReader = new SyncRecommendationsPostResponseObjectJsonReader(); using var stream = string.Empty.ToStream(); ITraktSyncRecommendationsPostResponse traktSyncRecommendationsPostResponse = await traktJsonReader.ReadObjectAsync(stream); traktSyncRecommendationsPostResponse.Should().BeNull(); }
public async Task Test_SyncRecommendationsPostResponseObjectJsonReader_ReadObject_From_Stream_Null() { var traktJsonReader = new SyncRecommendationsPostResponseObjectJsonReader(); Func <Task <ITraktSyncRecommendationsPostResponse> > traktSyncRecommendationsPostResponse = () => traktJsonReader.ReadObjectAsync(default(Stream)); await traktSyncRecommendationsPostResponse.Should().ThrowAsync <ArgumentNullException>(); }
public async Task Test_SyncRecommendationsPostResponseObjectJsonReader_ReadObject_From_Stream_Complete() { var traktJsonReader = new SyncRecommendationsPostResponseObjectJsonReader(); using var stream = JSON_COMPLETE.ToStream(); ITraktSyncRecommendationsPostResponse traktSyncRecommendationsPostResponse = await traktJsonReader.ReadObjectAsync(stream); traktSyncRecommendationsPostResponse.Should().NotBeNull(); traktSyncRecommendationsPostResponse.Added.Should().NotBeNull(); traktSyncRecommendationsPostResponse.Added.Movies.Should().Be(1); traktSyncRecommendationsPostResponse.Added.Shows.Should().Be(2); traktSyncRecommendationsPostResponse.Existing.Should().NotBeNull(); traktSyncRecommendationsPostResponse.Existing.Movies.Should().Be(3); traktSyncRecommendationsPostResponse.Existing.Shows.Should().Be(4); traktSyncRecommendationsPostResponse.NotFound.Should().NotBeNull(); traktSyncRecommendationsPostResponse.NotFound.Movies.Should().NotBeNull().And.HaveCount(1); ITraktSyncRecommendationsPostMovie[] notFoundMovies = traktSyncRecommendationsPostResponse.NotFound.Movies.ToArray(); notFoundMovies[0].Should().NotBeNull(); notFoundMovies[0].Ids.Should().NotBeNull(); notFoundMovies[0].Ids.Trakt.Should().Be(0U); notFoundMovies[0].Ids.Slug.Should().BeNull(); notFoundMovies[0].Ids.Imdb.Should().Be("tt0000111"); notFoundMovies[0].Ids.Tmdb.Should().BeNull(); traktSyncRecommendationsPostResponse.NotFound.Shows.Should().NotBeNull().And.HaveCount(1); ITraktSyncRecommendationsPostShow[] notFoundShows = traktSyncRecommendationsPostResponse.NotFound.Shows.ToArray(); notFoundShows[0].Should().NotBeNull(); notFoundShows[0].Ids.Should().NotBeNull(); notFoundShows[0].Ids.Trakt.Should().Be(0U); notFoundShows[0].Ids.Slug.Should().BeNull(); notFoundShows[0].Ids.Imdb.Should().Be("tt0000222"); notFoundShows[0].Ids.Tvdb.Should().BeNull(); notFoundShows[0].Ids.Tmdb.Should().BeNull(); }
public async Task Test_SyncRecommendationsPostResponseObjectJsonReader_ReadObject_From_JsonReader_Empty() { var traktJsonReader = new SyncRecommendationsPostResponseObjectJsonReader(); using var reader = new StringReader(string.Empty); using var jsonReader = new JsonTextReader(reader); ITraktSyncRecommendationsPostResponse traktSyncRecommendationsPostResponse = await traktJsonReader.ReadObjectAsync(jsonReader); traktSyncRecommendationsPostResponse.Should().BeNull(); }