Exemple #1
0
        public void Test_TraktMostAnticipatedMovie_Default_Constructor()
        {
            var anticipatedMovie = new TraktMostAnticipatedMovie();

            anticipatedMovie.ListCount.Should().NotHaveValue();

            anticipatedMovie.Movie.Should().BeNull();
            anticipatedMovie.Title.Should().BeNullOrEmpty();
            anticipatedMovie.Year.Should().NotHaveValue();
            anticipatedMovie.Ids.Should().BeNull();
            anticipatedMovie.Tagline.Should().BeNullOrEmpty();
            anticipatedMovie.Overview.Should().BeNullOrEmpty();
            anticipatedMovie.Released.Should().NotHaveValue();
            anticipatedMovie.Runtime.Should().NotHaveValue();
            anticipatedMovie.UpdatedAt.Should().NotHaveValue();
            anticipatedMovie.Trailer.Should().BeNullOrEmpty();
            anticipatedMovie.Homepage.Should().BeNullOrEmpty();
            anticipatedMovie.Rating.Should().NotHaveValue();
            anticipatedMovie.Votes.Should().NotHaveValue();
            anticipatedMovie.LanguageCode.Should().BeNullOrEmpty();
            anticipatedMovie.AvailableTranslationLanguageCodes.Should().BeNull();
            anticipatedMovie.Genres.Should().BeNull();
            anticipatedMovie.Certification.Should().BeNullOrEmpty();
            anticipatedMovie.CountryCode.Should().BeNullOrEmpty();
        }
Exemple #2
0
        public void TestTraktMoviesMostAnticipatedDefaultConstructor()
        {
            var anticipatedMovie = new TraktMostAnticipatedMovie();

            anticipatedMovie.ListCount.Should().NotHaveValue();
            anticipatedMovie.Movie.Should().BeNull();
        }
        public override async Task <ITraktMostAnticipatedMovie> ReadObjectAsync(JsonTextReader jsonReader, CancellationToken cancellationToken = default)
        {
            if (jsonReader == null)
            {
                return(await Task.FromResult(default(ITraktMostAnticipatedMovie)));
            }

            if (await jsonReader.ReadAsync(cancellationToken) && jsonReader.TokenType == JsonToken.StartObject)
            {
                var movieObjectReader = new MovieObjectJsonReader();
                ITraktMostAnticipatedMovie traktMostAnticipatedMovie = new TraktMostAnticipatedMovie();

                while (await jsonReader.ReadAsync(cancellationToken) && jsonReader.TokenType == JsonToken.PropertyName)
                {
                    var propertyName = jsonReader.Value.ToString();

                    switch (propertyName)
                    {
                    case JsonProperties.MOST_ANTICIPATED_MOVIE_PROPERTY_NAME_LIST_COUNT:
                        traktMostAnticipatedMovie.ListCount = await jsonReader.ReadAsInt32Async(cancellationToken);

                        break;

                    case JsonProperties.MOST_ANTICIPATED_MOVIE_PROPERTY_NAME_MOVIE:
                        traktMostAnticipatedMovie.Movie = await movieObjectReader.ReadObjectAsync(jsonReader, cancellationToken);

                        break;

                    default:
                        await JsonReaderHelper.ReadAndIgnoreInvalidContentAsync(jsonReader, cancellationToken);

                        break;
                    }
                }

                return(traktMostAnticipatedMovie);
            }

            return(await Task.FromResult(default(ITraktMostAnticipatedMovie)));
        }