Esempio n. 1
0
        public void Test_TraktCalendarFilterBuilder_GetParameters()
        {
            ITraktCalendarFilter filter = TraktFilterDirectory.CalendarFilter
                                          .WithQuery("query")
                                          .WithYears(2016, 2018)
                                          .WithGenres("action", "drama")
                                          .WithLanguages("de", "en")
                                          .WithCountries("gb", "us")
                                          .WithRuntimes(30, 180)
                                          .WithRatings(60, 90)
                                          .Build();

            filter.GetParameters().Should().NotBeNull().And.HaveCount(7);

            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" }
            });
        }
Esempio n. 2
0
        public void Test_TraktCalendarFilterBuilder_GetParameters_With_Years_Reversed()
        {
            ITraktCalendarFilter filter = TraktFilterDirectory.CalendarFilter.WithYears(2018, 2016).Build();

            filter.GetParameters().Should().NotBeNull().And.HaveCount(1);
            filter.GetParameters().Should().Contain(new Dictionary <string, object>()
            {
                { "years", "2016-2018" }
            });
        }
Esempio n. 3
0
        public void Test_TraktCalendarFilterBuilder_GetParameters_With_Query()
        {
            ITraktCalendarFilter filter = TraktFilterDirectory.CalendarFilter.WithQuery("query").Build();

            filter.GetParameters().Should().NotBeNull().And.HaveCount(1);
            filter.GetParameters().Should().Contain(new Dictionary <string, object>()
            {
                { "query", "query" }
            });
        }
Esempio n. 4
0
        public void Test_TraktCalendarFilterBuilder_GetParameters_With_Ratings()
        {
            ITraktCalendarFilter filter = TraktFilterDirectory.CalendarFilter.WithRatings(60, 90).Build();

            filter.GetParameters().Should().NotBeNull().And.HaveCount(1);
            filter.GetParameters().Should().Contain(new Dictionary <string, object>()
            {
                { "ratings", "60-90" }
            });
        }
Esempio n. 5
0
        public void Test_TraktCalendarFilterBuilder_GetParameters_With_Runtimes()
        {
            ITraktCalendarFilter filter = TraktFilterDirectory.CalendarFilter.WithRuntimes(30, 180).Build();

            filter.GetParameters().Should().NotBeNull().And.HaveCount(1);
            filter.GetParameters().Should().Contain(new Dictionary <string, object>()
            {
                { "runtimes", "30-180" }
            });
        }
Esempio n. 6
0
        public void Test_TraktCalendarFilterBuilder_GetParameters_With_Countries()
        {
            ITraktCalendarFilter filter = TraktFilterDirectory.CalendarFilter.WithCountries("gb", "us").Build();

            filter.GetParameters().Should().NotBeNull().And.HaveCount(1);
            filter.GetParameters().Should().Contain(new Dictionary <string, object>()
            {
                { "countries", "gb,us" }
            });
        }
Esempio n. 7
0
        public void Test_TraktCalendarFilterBuilder_GetParameters_With_Languages()
        {
            ITraktCalendarFilter filter = TraktFilterDirectory.CalendarFilter.WithLanguages("de", "en").Build();

            filter.GetParameters().Should().NotBeNull().And.HaveCount(1);
            filter.GetParameters().Should().Contain(new Dictionary <string, object>()
            {
                { "languages", "de,en" }
            });
        }
Esempio n. 8
0
        public void Test_TraktCalendarFilterBuilder_GetParameters_With_Genres()
        {
            ITraktCalendarFilter filter = TraktFilterDirectory.CalendarFilter.WithGenres("action", "drama").Build();

            filter.GetParameters().Should().NotBeNull().And.HaveCount(1);
            filter.GetParameters().Should().Contain(new Dictionary <string, object>()
            {
                { "genres", "action,drama" }
            });
        }
Esempio n. 9
0
        public void Test_TraktCalendarFilterBuilder_EmptyFilter()
        {
            ITraktCalendarFilter filter = TraktFilterDirectory.CalendarFilter.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.HasValues.Should().BeFalse();
            filter.ToString().Should().NotBeNull().And.BeEmpty();
            filter.GetParameters().Should().NotBeNull().And.BeEmpty();
        }
Esempio n. 10
0
            private void SetupPathParamters()
            {
                var strStartDate     = _startDate.ToTraktDateString();
                var strDays          = _days.ToString();
                var strExtendedInfo  = _extendedInfo.ToString();
                var filterParameters = _filter.GetParameters();

                _data.Add(new object[] { _request1.GetUriPathParameters(), new Dictionary <string, object>() });

                _data.Add(new object[] { _request2.GetUriPathParameters(), new Dictionary <string, object>
                                         {
                                             ["start_date"] = strStartDate
                                         } });

                _data.Add(new object[] { _request3.GetUriPathParameters(), new Dictionary <string, object>
                                         {
                                             ["start_date"] = strStartDate,
                                             ["days"]       = strDays
                                         } });

                var requestParameters = _request4.GetUriPathParameters();

                _data.Add(new object[] { requestParameters, new Dictionary <string, object>
                                         {
                                             ["start_date"] = requestParameters["start_date"],
                                             ["days"]       = strDays
                                         } });

                // with extended info
                _data.Add(new object[] { _request5.GetUriPathParameters(), new Dictionary <string, object>
                                         {
                                             ["extended"] = strExtendedInfo
                                         } });

                _data.Add(new object[] { _request6.GetUriPathParameters(), new Dictionary <string, object>
                                         {
                                             ["start_date"] = strStartDate,
                                             ["extended"]   = strExtendedInfo
                                         } });

                _data.Add(new object[] { _request7.GetUriPathParameters(), new Dictionary <string, object>
                                         {
                                             ["start_date"] = strStartDate,
                                             ["days"]       = strDays,
                                             ["extended"]   = strExtendedInfo
                                         } });

                requestParameters = _request8.GetUriPathParameters();
                _data.Add(new object[] { requestParameters, new Dictionary <string, object>
                                         {
                                             ["start_date"] = requestParameters["start_date"],
                                             ["days"]       = strDays,
                                             ["extended"]   = strExtendedInfo
                                         } });

                // with filter
                _data.Add(new object[] { _request9.GetUriPathParameters(), new Dictionary <string, object>(filterParameters) });

                _data.Add(new object[] { _request10.GetUriPathParameters(), new Dictionary <string, object>(filterParameters)
                                         {
                                             ["start_date"] = strStartDate
                                         } });

                _data.Add(new object[] { _request11.GetUriPathParameters(), new Dictionary <string, object>(filterParameters)
                                         {
                                             ["start_date"] = strStartDate,
                                             ["days"]       = strDays
                                         } });

                requestParameters = _request12.GetUriPathParameters();
                _data.Add(new object[] { _request12.GetUriPathParameters(), new Dictionary <string, object>(filterParameters)
                                         {
                                             ["start_date"] = requestParameters["start_date"],
                                             ["days"]       = strDays
                                         } });

                // with extended info and filter
                _data.Add(new object[] { _request13.GetUriPathParameters(), new Dictionary <string, object>(filterParameters)
                                         {
                                             ["extended"] = strExtendedInfo
                                         } });

                _data.Add(new object[] { _request14.GetUriPathParameters(), new Dictionary <string, object>(filterParameters)
                                         {
                                             ["start_date"] = strStartDate,
                                             ["extended"]   = strExtendedInfo
                                         } });

                _data.Add(new object[] { _request15.GetUriPathParameters(), new Dictionary <string, object>(filterParameters)
                                         {
                                             ["start_date"] = strStartDate,
                                             ["days"]       = strDays,
                                             ["extended"]   = strExtendedInfo
                                         } });

                requestParameters = _request16.GetUriPathParameters();
                _data.Add(new object[] { _request16.GetUriPathParameters(), new Dictionary <string, object>(filterParameters)
                                         {
                                             ["start_date"] = requestParameters["start_date"],
                                             ["days"]       = strDays,
                                             ["extended"]   = strExtendedInfo
                                         } });
            }