public void Test_TraktWatchedMovie_Default_Constructor() { var watchedMovie = new TraktWatchedMovie(); watchedMovie.Plays.Should().NotHaveValue(); watchedMovie.LastWatchedAt.Should().NotHaveValue(); watchedMovie.Movie.Should().BeNull(); watchedMovie.Title.Should().BeNullOrEmpty(); watchedMovie.Year.Should().NotHaveValue(); watchedMovie.Ids.Should().BeNull(); watchedMovie.Tagline.Should().BeNullOrEmpty(); watchedMovie.Overview.Should().BeNullOrEmpty(); watchedMovie.Released.Should().NotHaveValue(); watchedMovie.Runtime.Should().NotHaveValue(); watchedMovie.UpdatedAt.Should().NotHaveValue(); watchedMovie.Trailer.Should().BeNullOrEmpty(); watchedMovie.Homepage.Should().BeNullOrEmpty(); watchedMovie.Rating.Should().NotHaveValue(); watchedMovie.Votes.Should().NotHaveValue(); watchedMovie.LanguageCode.Should().BeNullOrEmpty(); watchedMovie.AvailableTranslationLanguageCodes.Should().BeNull(); watchedMovie.Genres.Should().BeNull(); watchedMovie.Certification.Should().BeNullOrEmpty(); watchedMovie.CountryCode.Should().BeNullOrEmpty(); }
public void TestTraktWatchedMovieDefaultConstructor() { var movieItem = new TraktWatchedMovie(); movieItem.Plays.Should().NotHaveValue(); movieItem.LastWatchedAt.Should().NotHaveValue(); movieItem.Movie.Should().BeNull(); }
public override async Task <ITraktWatchedMovie> ReadObjectAsync(JsonTextReader jsonReader, CancellationToken cancellationToken = default) { if (jsonReader == null) { return(await Task.FromResult(default(ITraktWatchedMovie))); } if (await jsonReader.ReadAsync(cancellationToken) && jsonReader.TokenType == JsonToken.StartObject) { var movieObjectReader = new MovieObjectJsonReader(); ITraktWatchedMovie traktWatchedMovie = new TraktWatchedMovie(); while (await jsonReader.ReadAsync(cancellationToken) && jsonReader.TokenType == JsonToken.PropertyName) { var propertyName = jsonReader.Value.ToString(); switch (propertyName) { case JsonProperties.WATCHED_MOVIE_PROPERTY_NAME_PLAYS: traktWatchedMovie.Plays = await jsonReader.ReadAsInt32Async(cancellationToken); break; case JsonProperties.WATCHED_MOVIE_PROPERTY_NAME_LAST_WATCHED_AT: { var value = await JsonReaderHelper.ReadDateTimeValueAsync(jsonReader, cancellationToken); if (value.First) { traktWatchedMovie.LastWatchedAt = value.Second; } break; } case JsonProperties.WATCHED_MOVIE_PROPERTY_NAME_MOVIE: traktWatchedMovie.Movie = await movieObjectReader.ReadObjectAsync(jsonReader, cancellationToken); break; default: await JsonReaderHelper.ReadAndIgnoreInvalidContentAsync(jsonReader, cancellationToken); break; } } return(traktWatchedMovie); } return(await Task.FromResult(default(ITraktWatchedMovie))); }