public void Test_TraktMovieFilterBuilder_GetParameters() { ITraktMovieFilter filter = TraktFilterDirectory.MovieFilter .WithQuery("query") .WithYears(2016, 2018) .WithGenres("action", "drama") .WithLanguages("de", "en") .WithCountries("gb", "us") .WithRuntimes(30, 180) .WithRatings(60, 90) .WithCertifications("pg-13", "nr") .Build(); filter.GetParameters().Should().NotBeNull().And.HaveCount(8); filter.GetParameters().Should().Contain(new Dictionary <string, object>() { { "query", "query" }, { "years", "2016-2018" }, { "genres", "action,drama" }, { "languages", "de,en" }, { "countries", "gb,us" }, { "runtimes", "30-180" }, { "ratings", "60-90" }, { "certifications", "pg-13,nr" } }); }
public void Test_TraktMovieFilterBuilder_HasValues() { ITraktMovieFilter filter = TraktFilterDirectory.MovieFilter.Build(); filter.HasValues.Should().BeFalse(); filter = TraktFilterDirectory.MovieFilter.WithQuery("query").Build(); filter.HasValues.Should().BeTrue(); filter = TraktFilterDirectory.MovieFilter.WithYear(2018).Build(); filter.HasValues.Should().BeTrue(); filter = TraktFilterDirectory.MovieFilter.WithYears(2016, 2018).Build(); filter.HasValues.Should().BeTrue(); filter = TraktFilterDirectory.MovieFilter.WithGenres("action", "drama").Build(); filter.HasValues.Should().BeTrue(); filter = TraktFilterDirectory.MovieFilter.WithLanguages("de", "en").Build(); filter.HasValues.Should().BeTrue(); filter = TraktFilterDirectory.MovieFilter.WithCountries("gb", "us").Build(); filter.HasValues.Should().BeTrue(); filter = TraktFilterDirectory.MovieFilter.WithRuntimes(30, 180).Build(); filter.HasValues.Should().BeTrue(); filter = TraktFilterDirectory.MovieFilter.WithRatings(60, 90).Build(); filter.HasValues.Should().BeTrue(); filter = TraktFilterDirectory.MovieFilter.WithCertifications("pg-13", "nr").Build(); filter.HasValues.Should().BeTrue(); }
public void Test_TraktMovieFilterBuilder_GetParameters_With_Certifications() { ITraktMovieFilter filter = TraktFilterDirectory.MovieFilter.WithCertifications("pg-13", "nr").Build(); filter.GetParameters().Should().NotBeNull().And.HaveCount(1); filter.GetParameters().Should().Contain(new Dictionary <string, object>() { { "certifications", "pg-13,nr" } }); }
public void Test_TraktMovieFilterBuilder_GetParameters_With_Ratings() { ITraktMovieFilter filter = TraktFilterDirectory.MovieFilter.WithRatings(60, 90).Build(); filter.GetParameters().Should().NotBeNull().And.HaveCount(1); filter.GetParameters().Should().Contain(new Dictionary <string, object>() { { "ratings", "60-90" } }); }
public void Test_TraktMovieFilterBuilder_GetParameters_With_Runtimes() { ITraktMovieFilter filter = TraktFilterDirectory.MovieFilter.WithRuntimes(30, 180).Build(); filter.GetParameters().Should().NotBeNull().And.HaveCount(1); filter.GetParameters().Should().Contain(new Dictionary <string, object>() { { "runtimes", "30-180" } }); }
public void Test_TraktMovieFilterBuilder_GetParameters_With_Countries() { ITraktMovieFilter filter = TraktFilterDirectory.MovieFilter.WithCountries("gb", "us").Build(); filter.GetParameters().Should().NotBeNull().And.HaveCount(1); filter.GetParameters().Should().Contain(new Dictionary <string, object>() { { "countries", "gb,us" } }); }
public void Test_TraktMovieFilterBuilder_GetParameters_With_Languages() { ITraktMovieFilter filter = TraktFilterDirectory.MovieFilter.WithLanguages("de", "en").Build(); filter.GetParameters().Should().NotBeNull().And.HaveCount(1); filter.GetParameters().Should().Contain(new Dictionary <string, object>() { { "languages", "de,en" } }); }
public void Test_TraktMovieFilterBuilder_GetParameters_With_Query() { ITraktMovieFilter filter = TraktFilterDirectory.MovieFilter.WithQuery("query").Build(); filter.GetParameters().Should().NotBeNull().And.HaveCount(1); filter.GetParameters().Should().Contain(new Dictionary <string, object>() { { "query", "query" } }); }
public void Test_TraktMovieFilterBuilder_GetParameters_With_Genres() { ITraktMovieFilter filter = TraktFilterDirectory.MovieFilter.WithGenres("action", "drama").Build(); filter.GetParameters().Should().NotBeNull().And.HaveCount(1); filter.GetParameters().Should().Contain(new Dictionary <string, object>() { { "genres", "action,drama" } }); }
public void Test_TraktMovieFilterBuilder_GetParameters_With_Years() { ITraktMovieFilter filter = TraktFilterDirectory.MovieFilter.WithYears(2016, 2018).Build(); filter.GetParameters().Should().NotBeNull().And.HaveCount(1); filter.GetParameters().Should().Contain(new Dictionary <string, object>() { { "years", "2016-2018" } }); }
/// <summary> /// Gets popular movies. /// <para>OAuth authorization not required.</para> /// <para> /// See <a href="http://docs.trakt.apiary.io/#reference/movies/popular/get-popular-movies">"Trakt API Doc - Movies: Popular"</a> for more information. /// </para> /// </summary> /// <param name="extendedInfo"> /// The extended info, which determines how much data about the movies should be queried. /// See also <seealso cref="TraktExtendedInfo" />. /// </param> /// <param name="filter">Optional filters for genres, languages, year, runtimes, ratings, etc. See also <seealso cref="TraktMovieFilter" />.</param> /// <param name="pagedParameters">Specifies pagination parameters. <see cref="TraktPagedParameters" />.</param> /// <param name="cancellationToken"> /// Propagates notification that the request should be canceled.<para/> /// If provided, the exception <see cref="OperationCanceledException" /> should be catched. /// </param> /// <returns> /// An <see cref="TraktPagedResponse{ITraktMovie}"/> instance containing the queried popular movies and which also /// contains the queried page number, the page's item count, maximum page count and maximum item count. /// <para> /// See also <seealso cref="TraktPagedResponse{ListItem}" /> and <seealso cref="ITraktMovie" />. /// </para> /// </returns> /// <exception cref="TraktException">Thrown, if the request fails.</exception> public Task <TraktPagedResponse <ITraktMovie> > GetPopularMoviesAsync(TraktExtendedInfo extendedInfo = null, ITraktMovieFilter filter = null, TraktPagedParameters pagedParameters = null, CancellationToken cancellationToken = default) { var requestHandler = new RequestHandler(Client); return(requestHandler.ExecutePagedRequestAsync(new MoviesPopularRequest { ExtendedInfo = extendedInfo, Filter = filter, Page = pagedParameters?.Page, Limit = pagedParameters?.Limit }, cancellationToken)); }
public void Test_TraktMovieFilterBuilder_ToString() { ITraktMovieFilter filter = TraktFilterDirectory.MovieFilter .WithQuery("query") .WithYears(2016, 2018) .WithGenres("action", "drama") .WithLanguages("de", "en") .WithCountries("gb", "us") .WithRuntimes(30, 180) .WithRatings(60, 90) .WithCertifications("pg-13", "nr") .Build(); filter.ToString().Should().Be("query=query&years=2016-2018&genres=action,drama&languages=de,en" + "&countries=gb,us&runtimes=30-180&ratings=60-90&certifications=pg-13,nr"); }
public void Test_TraktMovieFilterBuilder_EmptyFilter() { ITraktMovieFilter filter = TraktFilterDirectory.MovieFilter.Build(); filter.Query.Should().BeNull(); filter.Year.Should().BeNull(); filter.Years.Should().BeNull(); filter.Genres.Should().BeNull(); filter.Languages.Should().BeNull(); filter.Countries.Should().BeNull(); filter.Runtimes.Should().BeNull(); filter.Ratings.Should().BeNull(); filter.Certifications.Should().BeNull(); filter.HasValues.Should().BeFalse(); filter.ToString().Should().NotBeNull().And.BeEmpty(); filter.GetParameters().Should().NotBeNull().And.BeEmpty(); }
public void Test_TraktMovieFilterBuilder_ToString_With_Years_Reversed() { ITraktMovieFilter filter = TraktFilterDirectory.MovieFilter.WithYears(2018, 2016).Build(); filter.ToString().Should().Be("years=2016-2018"); }
public void Test_TraktMovieFilterBuilder_ToString_With_Query() { ITraktMovieFilter filter = TraktFilterDirectory.MovieFilter.WithQuery("query").Build(); filter.ToString().Should().Be("query=query"); }
public void Test_TraktMovieFilterBuilder_ToString_With_Ratings() { ITraktMovieFilter filter = TraktFilterDirectory.MovieFilter.WithRatings(60, 90).Build(); filter.ToString().Should().Be("ratings=60-90"); }
public void Test_TraktMovieFilterBuilder_ToString_With_Certifications() { ITraktMovieFilter filter = TraktFilterDirectory.MovieFilter.WithCertifications("pg-13", "nr").Build(); filter.ToString().Should().Be("certifications=pg-13,nr"); }
public void Test_TraktMovieFilterBuilder_ToString_With_Runtimes() { ITraktMovieFilter filter = TraktFilterDirectory.MovieFilter.WithRuntimes(30, 180).Build(); filter.ToString().Should().Be("runtimes=30-180"); }
public void Test_TraktMovieFilterBuilder_ToString_With_Countries() { ITraktMovieFilter filter = TraktFilterDirectory.MovieFilter.WithCountries("gb", "us").Build(); filter.ToString().Should().Be("countries=gb,us"); }
public void Test_TraktMovieFilterBuilder_ToString_With_Languages() { ITraktMovieFilter filter = TraktFilterDirectory.MovieFilter.WithLanguages("de", "en").Build(); filter.ToString().Should().Be("languages=de,en"); }
public void Test_TraktMovieFilterBuilder_ToString_With_Genres() { ITraktMovieFilter filter = TraktFilterDirectory.MovieFilter.WithGenres("action", "drama").Build(); filter.ToString().Should().Be("genres=action,drama"); }
/// <summary> /// Gets the most collected movies. /// <para>OAuth authorization not required.</para> /// <para> /// See <a href="http://docs.trakt.apiary.io/#reference/movies/watched/get-the-most-collected-movies">"Trakt API Doc - Movies: Collected"</a> for more information. /// </para> /// </summary> /// <param name="period">The time period, for which the most collected movies should be queried. See also <seealso cref="TraktTimePeriod" />.</param> /// <param name="extendedInfo"> /// The extended info, which determines how much data about the movies should be queried. /// See also <seealso cref="TraktExtendedInfo" />. /// </param> /// <param name="filter">Optional filters for genres, languages, year, runtimes, ratings, etc. See also <seealso cref="TraktMovieFilter" />.</param> /// <param name="pagedParameters">Specifies pagination parameters. <see cref="TraktPagedParameters" />.</param> /// <param name="cancellationToken"> /// Propagates notification that the request should be canceled.<para/> /// If provided, the exception <see cref="OperationCanceledException" /> should be catched. /// </param> /// <returns> /// An <see cref="TraktPagedResponse{ITraktMostPWCMovie}"/> instance containing the queried most collected movies and which also /// contains the queried page number, the page's item count, maximum page count and maximum item count. /// <para> /// See also <seealso cref="TraktPagedResponse{ListItem}" /> and <seealso cref="ITraktMostPWCMovie" />. /// </para> /// </returns> /// <exception cref="TraktException">Thrown, if the request fails.</exception> public Task <TraktPagedResponse <ITraktMostPWCMovie> > GetMostCollectedMoviesAsync(TraktTimePeriod period = null, TraktExtendedInfo extendedInfo = null, ITraktMovieFilter filter = null, TraktPagedParameters pagedParameters = null, CancellationToken cancellationToken = default) { var requestHandler = new RequestHandler(Client); return(requestHandler.ExecutePagedRequestAsync(new MoviesMostCollectedRequest { Period = period, ExtendedInfo = extendedInfo, Filter = filter, Page = pagedParameters?.Page, Limit = pagedParameters?.Limit }, cancellationToken)); }