public async Task Test_CalendarMovieObjectJsonWriter_WriteObject_StringWriter_Only_CalendarRelease_Property()
        {
            ITraktCalendarMovie traktCalendarMovie = new TraktCalendarMovie
            {
                CalendarRelease = TODAY
            };

            using (var stringWriter = new StringWriter())
            {
                var    traktJsonWriter = new CalendarMovieObjectJsonWriter();
                string json            = await traktJsonWriter.WriteObjectAsync(stringWriter, traktCalendarMovie);

                json.Should().Be($"{{\"released\":\"{TODAY.ToTraktDateString()}\"}}");
            }
        }
Exemple #2
0
        public async Task Test_TraktCalendarModule_GetAllMovies_With_Days()
        {
            TraktClient client = TestUtility.GetMockClient($"{GET_ALL_MOVIES_URI}/{TODAY.ToTraktDateString()}/{DAYS}",
                                                           CALENDAR_ALL_MOVIES_JSON,
                                                           startDate: START_DATE, endDate: END_DATE);

            TraktListResponse <ITraktCalendarMovie> response = await client.Calendar.GetAllMoviesAsync(null, DAYS);

            response.Should().NotBeNull();
            response.IsSuccess.Should().BeTrue();
            response.HasValue.Should().BeTrue();
            response.Value.Should().NotBeNull().And.HaveCount(3);
            response.StartDate.Should().HaveValue();
            response.StartDate.Equals(StartDateTime).Should().BeTrue();
            response.EndDate.Should().HaveValue();
            response.EndDate.Equals(EndDateTime).Should().BeTrue();
        }
Exemple #3
0
        public async Task Test_TraktCalendarModule_GetAllMovies_With_ExtendedInfo_And_StartDate_And_Days_Filtered()
        {
            TraktClient client = TestUtility.GetMockClient($"{GET_ALL_MOVIES_URI}/{TODAY.ToTraktDateString()}/{DAYS}?extended={EXTENDED_INFO}&{FILTER}",
                                                           CALENDAR_ALL_MOVIES_JSON,
                                                           startDate: START_DATE, endDate: END_DATE);

            TraktListResponse <ITraktCalendarMovie> response = await client.Calendar.GetAllMoviesAsync(TODAY, DAYS, EXTENDED_INFO, FILTER);

            response.Should().NotBeNull();
            response.IsSuccess.Should().BeTrue();
            response.HasValue.Should().BeTrue();
            response.Value.Should().NotBeNull().And.HaveCount(3);
            response.StartDate.Should().HaveValue();
            response.StartDate.Equals(StartDateTime).Should().BeTrue();
            response.EndDate.Should().HaveValue();
            response.EndDate.Equals(EndDateTime).Should().BeTrue();
        }
        public async Task Test_TraktCalendarModule_GetAllShows_With_StartDate_Filtered()
        {
            TraktClient client = TestUtility.GetMockClient($"{GET_ALL_SHOWS_URI}/{TODAY.ToTraktDateString()}?{FILTER}",
                                                           CALENDAR_ALL_SHOWS_JSON,
                                                           startDate: START_DATE, endDate: END_DATE);

            TraktListResponse <ITraktCalendarShow> response = await client.Calendar.GetAllShowsAsync(TODAY, null, null, FILTER);

            response.Should().NotBeNull();
            response.IsSuccess.Should().BeTrue();
            response.HasValue.Should().BeTrue();
            response.Value.Should().NotBeNull().And.HaveCount(2);
            response.StartDate.Should().HaveValue();
            response.StartDate.Equals(StartDateTime).Should().BeTrue();
            response.EndDate.Should().HaveValue();
            response.EndDate.Equals(EndDateTime).Should().BeTrue();
        }
Exemple #5
0
        public async Task Test_TraktShowsModule_GetRecentlyUpdatedShows_With_StartDate()
        {
            TraktClient client = TestUtility.GetMockClient(
                $"{GET_RECENTLY_UPDATED_SHOWS_URI}/{TODAY.ToTraktDateString()}",
                RECENTLY_UPDATED_SHOWS_JSON, 1, 10, 1, ITEM_COUNT);

            TraktPagedResponse <ITraktRecentlyUpdatedShow> response =
                await client.Shows.GetRecentlyUpdatedShowsAsync(TODAY);

            response.Should().NotBeNull();
            response.IsSuccess.Should().BeTrue();
            response.HasValue.Should().BeTrue();
            response.Value.Should().NotBeNull().And.HaveCount(ITEM_COUNT);
            response.ItemCount.Should().HaveValue().And.Be(ITEM_COUNT);
            response.Limit.Should().Be(10u);
            response.Page.Should().Be(1u);
            response.PageCount.Should().HaveValue().And.Be(1);
        }
Exemple #6
0
        public async Task Test_TraktShowsModule_GetRecentlyUpdatedShows_Complete()
        {
            TraktClient client = TestUtility.GetMockClient(
                $"{GET_RECENTLY_UPDATED_SHOWS_URI}/{TODAY.ToTraktDateString()}?extended={EXTENDED_INFO}&page={PAGE}&limit={LIMIT}",
                RECENTLY_UPDATED_SHOWS_JSON, PAGE, LIMIT, 1, ITEM_COUNT);

            var pagedParameters = new TraktPagedParameters(PAGE, LIMIT);

            TraktPagedResponse <ITraktRecentlyUpdatedShow> response =
                await client.Shows.GetRecentlyUpdatedShowsAsync(TODAY, EXTENDED_INFO, pagedParameters);

            response.Should().NotBeNull();
            response.IsSuccess.Should().BeTrue();
            response.HasValue.Should().BeTrue();
            response.Value.Should().NotBeNull().And.HaveCount(ITEM_COUNT);
            response.ItemCount.Should().HaveValue().And.Be(ITEM_COUNT);
            response.Limit.Should().Be(LIMIT);
            response.Page.Should().Be(PAGE);
            response.PageCount.Should().HaveValue().And.Be(1);
        }
        public async Task Test_TraktCalendarModule_GetUserNewShows_WithExtendedInfoAndStartDateAndDaysFiltered()
        {
            TraktClient client = TestUtility.GetOAuthMockClient($"{GET_USER_NEW_SHOWS_URI}/{TODAY.ToTraktDateString()}/{DAYS}?extended={EXTENDED_INFO}&{FILTER}",
                                                                CALENDAR_ALL_SHOWS_JSON,
                                                                startDate: START_DATE, endDate: END_DATE);

            TraktListResponse <ITraktCalendarShow> response = await client.Calendar.GetUserNewShowsAsync(TODAY, DAYS, EXTENDED_INFO, FILTER);

            response.Should().NotBeNull();
            response.IsSuccess.Should().BeTrue();
            response.HasValue.Should().BeTrue();
            response.Value.Should().NotBeNull().And.HaveCount(2);
            response.StartDate.Should().HaveValue();
            response.StartDate.Equals(StartDateTime).Should().BeTrue();
            response.EndDate.Should().HaveValue();
            response.EndDate.Equals(EndDateTime).Should().BeTrue();
        }
Exemple #8
0
        public async Task Test_TraktMoviesModule_GetRecentlyUpdatedMovies_With_StartDate_And_Page_And_Limit()
        {
            TraktClient client = TestUtility.GetMockClient($"{GET_RECENTLY_UPDATED_MOVIES_URI}/{TODAY.ToTraktDateString()}?page={PAGE}&limit={LIMIT}",
                                                           RECENTLY_UPDATED_MOVIES_JSON, PAGE, LIMIT, 1, ITEM_COUNT);

            var pagedParameters = new TraktPagedParameters(PAGE, LIMIT);
            TraktPagedResponse <ITraktRecentlyUpdatedMovie> response = await client.Movies.GetRecentlyUpdatedMoviesAsync(TODAY, null, pagedParameters);

            response.Should().NotBeNull();
            response.IsSuccess.Should().BeTrue();
            response.HasValue.Should().BeTrue();
            response.Value.Should().NotBeNull().And.HaveCount(ITEM_COUNT);
            response.ItemCount.Should().HaveValue().And.Be(ITEM_COUNT);
            response.Limit.Should().Be(LIMIT);
            response.Page.Should().Be(PAGE);
            response.PageCount.Should().HaveValue().And.Be(1);
        }
Exemple #9
0
        public async Task Test_TraktMoviesModule_GetRecentlyUpdatedMovies_With_StartDate_And_ExtendedInfo()
        {
            TraktClient client = TestUtility.GetMockClient($"{GET_RECENTLY_UPDATED_MOVIES_URI}/{TODAY.ToTraktDateString()}?extended={EXTENDED_INFO}",
                                                           RECENTLY_UPDATED_MOVIES_JSON, 1, 10, 1, ITEM_COUNT);

            TraktPagedResponse <ITraktRecentlyUpdatedMovie> response = await client.Movies.GetRecentlyUpdatedMoviesAsync(TODAY, EXTENDED_INFO);

            response.Should().NotBeNull();
            response.IsSuccess.Should().BeTrue();
            response.HasValue.Should().BeTrue();
            response.Value.Should().NotBeNull().And.HaveCount(ITEM_COUNT);
            response.ItemCount.Should().HaveValue().And.Be(ITEM_COUNT);
            response.Limit.Should().Be(10u);
            response.Page.Should().Be(1u);
            response.PageCount.Should().HaveValue().And.Be(1);
        }
        public async Task Test_TraktCalendarModule_GetUserDVDMovies_With_StartDate_Filtered()
        {
            TraktClient client = TestUtility.GetOAuthMockClient($"{GET_USER_DVD_MOVIES_URI}/{TODAY.ToTraktDateString()}?{FILTER}",
                                                                CALENDAR_DVD_MOVIES_JSON,
                                                                startDate: START_DATE, endDate: END_DATE);

            var response = await client.Calendar.GetUserDVDMoviesAsync(TODAY, null, null, FILTER);

            response.Should().NotBeNull();
            response.IsSuccess.Should().BeTrue();
            response.HasValue.Should().BeTrue();
            response.Value.Should().NotBeNull().And.HaveCount(3);
            response.StartDate.Should().HaveValue();
            response.StartDate.Equals(StartDateTime).Should().BeTrue();
            response.EndDate.Should().HaveValue();
            response.EndDate.Equals(EndDateTime).Should().BeTrue();
        }
        public async Task Test_TraktCalendarModule_GetUserDVDMovies_With_ExtendedInfo_And_StartDate_And_Days()
        {
            TraktClient client = TestUtility.GetOAuthMockClient($"{GET_USER_DVD_MOVIES_URI}/{TODAY.ToTraktDateString()}/{DAYS}?extended={EXTENDED_INFO}",
                                                                CALENDAR_DVD_MOVIES_JSON,
                                                                startDate: START_DATE, endDate: END_DATE);

            var response = await client.Calendar.GetUserDVDMoviesAsync(TODAY, DAYS, EXTENDED_INFO);

            response.Should().NotBeNull();
            response.IsSuccess.Should().BeTrue();
            response.HasValue.Should().BeTrue();
            response.Value.Should().NotBeNull().And.HaveCount(3);
            response.StartDate.Should().HaveValue();
            response.StartDate.Equals(StartDateTime).Should().BeTrue();
            response.EndDate.Should().HaveValue();
            response.EndDate.Equals(EndDateTime).Should().BeTrue();
        }
Exemple #12
0
        public async Task Test_TraktCalendarModule_GetAllSeasonPremieres_With_ExtendedInfo_And_Days()
        {
            TraktClient client = TestUtility.GetMockClient($"{GET_ALL_SEASON_PREMIERES_URI}/{TODAY.ToTraktDateString()}/{DAYS}?extended={EXTENDED_INFO}",
                                                           CALENDAR_ALL_SHOWS_JSON,
                                                           startDate: START_DATE, endDate: END_DATE);

            TraktListResponse <ITraktCalendarShow> response = await client.Calendar.GetAllSeasonPremieresAsync(null, DAYS, EXTENDED_INFO);

            response.Should().NotBeNull();
            response.IsSuccess.Should().BeTrue();
            response.HasValue.Should().BeTrue();
            response.Value.Should().NotBeNull().And.HaveCount(2);
            response.StartDate.Should().HaveValue();
            response.StartDate.Equals(StartDateTime).Should().BeTrue();
            response.EndDate.Should().HaveValue();
            response.EndDate.Equals(EndDateTime).Should().BeTrue();
        }
        public async Task Test_CalendarMovieObjectJsonWriter_WriteObject_StringWriter_Complete()
        {
            ITraktCalendarMovie traktCalendarMovie = new TraktCalendarMovie
            {
                CalendarRelease = TODAY,
                Movie           = new TraktMovie
                {
                    Title = "Star Wars: The Force Awakens",
                    Year  = 2015,
                    Ids   = new TraktMovieIds
                    {
                        Trakt = 94024U,
                        Slug  = "star-wars-the-force-awakens-2015",
                        Imdb  = "tt2488496",
                        Tmdb  = 140607U
                    },
                    Tagline      = "Every generation has a story.",
                    Overview     = "Thirty years after defeating the Galactic Empire, Han Solo and his allies face a new threat from the evil Kylo Ren and his army of Stormtroopers.",
                    Released     = RELEASED,
                    Runtime      = 136,
                    UpdatedAt    = UPDATED_AT,
                    Trailer      = "http://youtube.com/watch?v=uwa7N0ShN2U",
                    Homepage     = "http://www.starwars.com/films/star-wars-episode-vii",
                    Rating       = 8.31988f,
                    Votes        = 9338,
                    LanguageCode = "en",
                    AvailableTranslationLanguageCodes = new List <string>
                    {
                        "en",
                        "de",
                        "it"
                    },
                    Genres = new List <string>
                    {
                        "action",
                        "adventure",
                        "fantasy",
                        "science-fiction"
                    },
                    Certification = "PG-13",
                    CountryCode   = "us",
                    CommentCount  = 153
                }
            };

            using (var stringWriter = new StringWriter())
            {
                var    traktJsonWriter = new CalendarMovieObjectJsonWriter();
                string json            = await traktJsonWriter.WriteObjectAsync(stringWriter, traktCalendarMovie);

                json.Should().Be($"{{\"released\":\"{TODAY.ToTraktDateString()}\"," +
                                 @"""movie"":{""title"":""Star Wars: The Force Awakens"",""year"":2015," +
                                 @"""ids"":{""trakt"":94024,""slug"":""star-wars-the-force-awakens-2015""," +
                                 @"""imdb"":""tt2488496"",""tmdb"":140607}," +
                                 @"""tagline"":""Every generation has a story.""," +
                                 @"""overview"":""Thirty years after defeating the Galactic Empire, " +
                                 @"Han Solo and his allies face a new threat from the evil Kylo Ren and his army of Stormtroopers.""," +
                                 $"\"released\":\"{RELEASED.ToTraktDateString()}\"," +
                                 @"""runtime"":136,""trailer"":""http://youtube.com/watch?v=uwa7N0ShN2U""," +
                                 @"""homepage"":""http://www.starwars.com/films/star-wars-episode-vii""," +
                                 @"""rating"":8.31988,""votes"":9338," +
                                 $"\"updated_at\":\"{UPDATED_AT.ToTraktLongDateTimeString()}\"," +
                                 @"""language"":""en"",""available_translations"":[" +
                                 @"""en"",""de"",""it""],""genres"":[""action"",""adventure""," +
                                 @"""fantasy"",""science-fiction""]," +
                                 @"""certification"":""PG-13"",""country"":""us"",""comment_count"":153}}");
            }
        }
        public async Task Test_TraktCalendarModule_GetUserSeasonPremieres_With_StartDate()
        {
            TraktClient client = TestUtility.GetOAuthMockClient($"{GET_USER_SEASON_PREMIERES_URI}/{TODAY.ToTraktDateString()}",
                                                                CALENDAR_ALL_SHOWS_JSON,
                                                                startDate: START_DATE, endDate: END_DATE);

            TraktListResponse <ITraktCalendarShow> response = await client.Calendar.GetUserSeasonPremieresAsync(TODAY);

            response.Should().NotBeNull();
            response.IsSuccess.Should().BeTrue();
            response.HasValue.Should().BeTrue();
            response.Value.Should().NotBeNull().And.HaveCount(2);
            response.StartDate.Should().HaveValue();
            response.StartDate.Equals(StartDateTime).Should().BeTrue();
            response.EndDate.Should().HaveValue();
            response.EndDate.Equals(EndDateTime).Should().BeTrue();
        }