Пример #1
0
        private async Task <List <ShowSql> > RefreshShowHiddenItem(IDatabase database)
        {
            List <ShowSql> res = new List <ShowSql>();
            TraktPagedResponse <ITraktUserHiddenItem> hiddenShow = await Client.Users
                                                                   .GetHiddenItemsAsync(TraktHiddenItemsSection.ProgressCollected, TraktHiddenItemType.Show)
                                                                   .ConfigureAwait(false);

            TraktPagedResponse <ITraktUserHiddenItem> hiddenShowRes = hiddenShow;

            foreach (ITraktUserHiddenItem traktUserHiddenItem in hiddenShowRes)
            {
                ShowSql localShow = GetShow(database, traktUserHiddenItem.Show.Ids.Trakt);

                localShow.Update(traktUserHiddenItem);

                res.Add(localShow);
            }

            return(res);
        }
Пример #2
0
        public async Task Test_TraktUsersModule_GetHiddenItems_With_Type_And_Page()
        {
            TraktClient client = TestUtility.GetOAuthMockClient(
                $"{GetHiddenItemsUri}?type={HIDDEN_ITEM_TYPE.UriName}&page={PAGE}",
                HIDDEN_ITEMS_JSON, PAGE, 10, 1, HIDDEN_ITEMS_COUNT);

            var pagedParameters = new TraktPagedParameters(PAGE);

            TraktPagedResponse <ITraktUserHiddenItem> response =
                await client.Users.GetHiddenItemsAsync(HIDDEN_ITEMS_SECTION, HIDDEN_ITEM_TYPE, null, pagedParameters);

            response.Should().NotBeNull();
            response.IsSuccess.Should().BeTrue();
            response.HasValue.Should().BeTrue();
            response.Value.Should().NotBeNull().And.HaveCount(HIDDEN_ITEMS_COUNT);
            response.ItemCount.Should().HaveValue().And.Be(HIDDEN_ITEMS_COUNT);
            response.Limit.Should().Be(10u);
            response.Page.Should().Be(PAGE);
            response.PageCount.Should().HaveValue().And.Be(1);
        }
Пример #3
0
        public async Task Test_TraktShowsModule_GetMostAnticipatedShows_With_ExtendedInfo_And_Page_Filtered()
        {
            TraktClient client = TestUtility.GetMockClient(
                $"{GET_MOST_ANTICIPATED_SHOWS_URI}?extended={EXTENDED_INFO}&{FILTER}&page={PAGE}",
                MOST_ANTICIPATED_SHOWS_JSON, PAGE, 10, 1, ITEM_COUNT);

            var pagedParameters = new TraktPagedParameters(PAGE);

            TraktPagedResponse <ITraktMostAnticipatedShow> response =
                await client.Shows.GetMostAnticipatedShowsAsync(EXTENDED_INFO, FILTER, 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(10u);
            response.Page.Should().Be(PAGE);
            response.PageCount.Should().HaveValue().And.Be(1);
        }
Пример #4
0
        public async Task Test_TraktSyncModule_GetRatings_With_Type_And_RatingsFilter_1_2()
        {
            var ratingsFilter = new int[] { 1, 2 };

            TraktClient client = TestUtility.GetOAuthMockClient(
                $"{GET_RATINGS_URI}/{RATINGS_ITEM_TYPE.UriName}/{BuildRatingsFilterString(ratingsFilter)}",
                RATINGS_JSON, 1, 10, 1, RATINGS_ITEM_COUNT);

            TraktPagedResponse <ITraktRatingsItem> response =
                await client.Sync.GetRatingsAsync(RATINGS_ITEM_TYPE, ratingsFilter);

            response.Should().NotBeNull();
            response.IsSuccess.Should().BeTrue();
            response.HasValue.Should().BeTrue();
            response.Value.Should().NotBeNull().And.HaveCount(4);
            response.ItemCount.Should().HaveValue().And.Be(RATINGS_ITEM_COUNT);
            response.Limit.Should().Be(10u);
            response.Page.Should().Be(1u);
            response.PageCount.Should().HaveValue().And.Be(1);
        }
Пример #5
0
        public async Task Test_TraktShowsModule_GetShowLists_With_Page()
        {
            TraktClient client = TestUtility.GetMockClient(
                $"{GET_SHOW_LISTS_URI}?page={PAGE}",
                SHOW_LISTS_JSON, PAGE, 10, 1, LISTS_ITEM_COUNT);

            var pagedParameters = new TraktPagedParameters(PAGE);

            TraktPagedResponse <ITraktList> response =
                await client.Shows.GetShowListsAsync(SHOW_ID, null, null, pagedParameters);

            response.Should().NotBeNull();
            response.IsSuccess.Should().BeTrue();
            response.HasValue.Should().BeTrue();
            response.Value.Should().NotBeNull().And.HaveCount(LISTS_ITEM_COUNT);
            response.ItemCount.Should().HaveValue().And.Be(LISTS_ITEM_COUNT);
            response.Limit.Should().Be(10u);
            response.Page.Should().Be(PAGE);
            response.PageCount.Should().HaveValue().And.Be(1);
        }
Пример #6
0
        public async Task Test_TraktShowsModule_GetMostCollectedShows_With_ExtendedInfo_And_Limit()
        {
            TraktClient client = TestUtility.GetMockClient(
                $"{GET_MOST_COLLECTED_SHOWS_URI}?extended={EXTENDED_INFO}&limit={LIMIT}",
                MOST_COLLECTED_SHOWS_JSON, 1, LIMIT, 1, ITEM_COUNT);

            var pagedParameters = new TraktPagedParameters(null, LIMIT);

            TraktPagedResponse <ITraktMostPWCShow> response =
                await client.Shows.GetMostCollectedShowsAsync(null, EXTENDED_INFO, 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(1u);
            response.PageCount.Should().HaveValue().And.Be(1);
        }
Пример #7
0
        public async Task Test_TraktShowsModule_GetMostCollectedShows_Complete_Filtered()
        {
            TraktClient client = TestUtility.GetMockClient(
                $"{GET_MOST_COLLECTED_SHOWS_URI}/{TIME_PERIOD.UriName}?extended={EXTENDED_INFO}&page={PAGE}&limit={LIMIT}&{FILTER}",
                MOST_COLLECTED_SHOWS_JSON, PAGE, LIMIT, 1, ITEM_COUNT);

            var pagedParameters = new TraktPagedParameters(PAGE, LIMIT);

            TraktPagedResponse <ITraktMostPWCShow> response =
                await client.Shows.GetMostCollectedShowsAsync(TIME_PERIOD, EXTENDED_INFO, FILTER, 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);
        }
Пример #8
0
        public async Task Test_TraktUsersModule_GetPersonalRecommendations_With_Limit()
        {
            TraktClient client = TestUtility.GetOAuthMockClient(
                $"{GET_PERSONAL_RECOMMENDATIONS_URI}?limit={RECOMMENDATIONS_LIMIT}",
                USER_RECOMMENDATIONS_JSON, 1, RECOMMENDATIONS_LIMIT, 1, RECOMMENDATIONS_ITEM_COUNT);

            var pagedParameters = new TraktPagedParameters(null, RECOMMENDATIONS_LIMIT);

            TraktPagedResponse <ITraktRecommendation> response =
                await client.Users.GetPersonalRecommendationsAsync(USERNAME, null, null, null, pagedParameters);

            response.Should().NotBeNull();
            response.IsSuccess.Should().BeTrue();
            response.HasValue.Should().BeTrue();
            response.Value.Should().NotBeNull().And.HaveCount(RECOMMENDATIONS_ITEM_COUNT);
            response.ItemCount.Should().HaveValue().And.Be(RECOMMENDATIONS_ITEM_COUNT);
            response.Limit.Should().Be(RECOMMENDATIONS_LIMIT);
            response.Page.Should().Be(1u);
            response.PageCount.Should().HaveValue().And.Be(1);
        }
Пример #9
0
        public async Task Test_TraktUsersModule_GetPersonalRecommendations_With_RecommendationType_And_SortOrder_And_Page()
        {
            TraktClient client = TestUtility.GetOAuthMockClient(
                $"{GET_PERSONAL_RECOMMENDATIONS_URI}/{RECOMMENDATION_TYPE.UriName}/{RECOMMENDATION_SORT_ORDER.UriName}?page={PAGE}",
                USER_RECOMMENDATIONS_JSON, PAGE, 10, 1, RECOMMENDATIONS_ITEM_COUNT);

            var pagedParameters = new TraktPagedParameters(PAGE);

            TraktPagedResponse <ITraktRecommendation> response =
                await client.Users.GetPersonalRecommendationsAsync(USERNAME, RECOMMENDATION_TYPE, RECOMMENDATION_SORT_ORDER, null, pagedParameters);

            response.Should().NotBeNull();
            response.IsSuccess.Should().BeTrue();
            response.HasValue.Should().BeTrue();
            response.Value.Should().NotBeNull().And.HaveCount(RECOMMENDATIONS_ITEM_COUNT);
            response.ItemCount.Should().HaveValue().And.Be(RECOMMENDATIONS_ITEM_COUNT);
            response.Limit.Should().Be(10u);
            response.Page.Should().Be(PAGE);
            response.PageCount.Should().HaveValue().And.Be(1);
        }
        public async Task Test_TraktSearchModule_GetIdLookupResults_Complete()
        {
            TraktClient client = TestUtility.GetMockClient(
                $"{GetIdLookupUri}?type={ID_LOOKUP_RESULT_TYPE.UriName}&extended={EXTENDED_INFO}&page={PAGE}&limit={LIMIT}",
                SEARCH_ID_LOOKUP_RESULTS_JSON, PAGE, LIMIT, 1, ID_LOOKUP_ITEM_COUNT);

            var pagedParameters = new TraktPagedParameters(PAGE, LIMIT);

            TraktPagedResponse <ITraktSearchResult> response =
                await client.Search.GetIdLookupResultsAsync(ID_LOOKUP_TYPE, LOOKUP_ID, ID_LOOKUP_RESULT_TYPE, EXTENDED_INFO, pagedParameters);

            response.Should().NotBeNull();
            response.IsSuccess.Should().BeTrue();
            response.HasValue.Should().BeTrue();
            response.Value.Should().NotBeNull().And.HaveCount(ID_LOOKUP_ITEM_COUNT);
            response.ItemCount.Should().HaveValue().And.Be(ID_LOOKUP_ITEM_COUNT);
            response.Limit.Should().Be(LIMIT);
            response.Page.Should().Be(PAGE);
            response.PageCount.Should().HaveValue().And.Be(1);
        }
Пример #11
0
        public async Task Test_TraktUsersModule_GetPersonalRecommendations_With_ExtendedInfo_And_Page()
        {
            TraktClient client = TestUtility.GetOAuthMockClient(
                $"{GET_PERSONAL_RECOMMENDATIONS_URI}?extended={EXTENDED_INFO}&page={PAGE}",
                USER_RECOMMENDATIONS_JSON, PAGE, 10, 1, RECOMMENDATIONS_ITEM_COUNT);

            var pagedParameters = new TraktPagedParameters(PAGE);

            TraktPagedResponse <ITraktRecommendation> response =
                await client.Users.GetPersonalRecommendationsAsync(USERNAME, null, null, EXTENDED_INFO, pagedParameters);

            response.Should().NotBeNull();
            response.IsSuccess.Should().BeTrue();
            response.HasValue.Should().BeTrue();
            response.Value.Should().NotBeNull().And.HaveCount(RECOMMENDATIONS_ITEM_COUNT);
            response.ItemCount.Should().HaveValue().And.Be(RECOMMENDATIONS_ITEM_COUNT);
            response.Limit.Should().Be(10u);
            response.Page.Should().Be(PAGE);
            response.PageCount.Should().HaveValue().And.Be(1);
        }
        public async Task Test_TraktUsersModule_GetLikes_With_Type_And_Limit()
        {
            TraktClient client = TestUtility.GetOAuthMockClient(
                $"{GET_LIKES_URI}/{LIKE_TYPE.UriName}?limit={LIKES_LIMIT}",
                LIKES_JSON, 1, LIKES_LIMIT, 1, LIKES_ITEM_COUNT);

            var pagedParameters = new TraktPagedParameters(null, LIKES_LIMIT);

            TraktPagedResponse <ITraktUserLikeItem> response =
                await client.Users.GetLikesAsync(LIKE_TYPE, pagedParameters);

            response.Should().NotBeNull();
            response.IsSuccess.Should().BeTrue();
            response.HasValue.Should().BeTrue();
            response.Value.Should().NotBeNull().And.HaveCount(LIKES_ITEM_COUNT);
            response.ItemCount.Should().HaveValue().And.Be(LIKES_ITEM_COUNT);
            response.Limit.Should().Be(LIKES_LIMIT);
            response.Page.Should().Be(1u);
            response.PageCount.Should().HaveValue().And.Be(1);
        }
        public async Task Test_TraktUsersModule_GetLikes_With_Page()
        {
            TraktClient client = TestUtility.GetOAuthMockClient(
                $"{GET_LIKES_URI}?page={PAGE}",
                LIKES_JSON, PAGE, 10, 1, LIKES_ITEM_COUNT);

            var pagedParameters = new TraktPagedParameters(PAGE);

            TraktPagedResponse <ITraktUserLikeItem> response =
                await client.Users.GetLikesAsync(null, pagedParameters);

            response.Should().NotBeNull();
            response.IsSuccess.Should().BeTrue();
            response.HasValue.Should().BeTrue();
            response.Value.Should().NotBeNull().And.HaveCount(LIKES_ITEM_COUNT);
            response.ItemCount.Should().HaveValue().And.Be(LIKES_ITEM_COUNT);
            response.Limit.Should().Be(10u);
            response.Page.Should().Be(PAGE);
            response.PageCount.Should().HaveValue().And.Be(1);
        }
Пример #14
0
        private async Task <List <ShowSql> > RefreshSeasonHiddenItem(IDatabase database, List <ShowSql> shows)
        {
            Dictionary <uint, ShowSql> res = shows.ToDictionary(s => s.Id);
            TraktPagedResponse <ITraktUserHiddenItem> hiddenSeason = await Client.Users.GetHiddenItemsAsync(TraktHiddenItemsSection.ProgressCollected, TraktHiddenItemType.Season).ConfigureAwait(false);

            TraktPagedResponse <ITraktUserHiddenItem> hiddenSeasonRes = hiddenSeason;

            foreach (ITraktUserHiddenItem traktUserHiddenItem in hiddenSeasonRes)
            {
                ShowSql localShow = res.ContainsKey(traktUserHiddenItem.Show.Ids.Trakt) ? res[traktUserHiddenItem.Show.Ids.Trakt] : GetShow(database, traktUserHiddenItem.Show.Ids.Trakt);

                SeasonSql localSeason = GetSeason(localShow, traktUserHiddenItem.Season.Number.Value);

                localSeason.Update(traktUserHiddenItem);

                res[localShow.Id] = localShow;
            }

            return(res.Values.ToList());
        }
Пример #15
0
        public async Task Test_TraktShowsModule_GetMostPlayedShows_With_Period_And_Limit_Filtered()
        {
            TraktClient client = TestUtility.GetMockClient(
                $"{GET_MOST_PLAYED_SHOWS_URI}/{TIME_PERIOD.UriName}?limit={LIMIT}&{FILTER}",
                MOST_PLAYED_SHOWS_JSON, 1, LIMIT, 1, ITEM_COUNT);

            var pagedParameters = new TraktPagedParameters(null, LIMIT);

            TraktPagedResponse <ITraktMostPWCShow> response =
                await client.Shows.GetMostPlayedShowsAsync(TIME_PERIOD, null, FILTER, 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(1u);
            response.PageCount.Should().HaveValue().And.Be(1);
        }
        public async Task Test_TraktCommentsModule_GetRecentlyUpdatedComments_With_ObjectType_And_IncludeReplies_And_Page_And_Limit()
        {
            TraktClient client = TestUtility.GetMockClient(
                $"{GET_COMMENTS_UPDATES_URI}/{OBJECT_TYPE.UriName}?include_replies=true&page={PAGE}&limit={LIMIT}",
                COMMENTS_JSON, PAGE, LIMIT, 1, COMMENTS_ITEM_COUNT);

            var pagedParameters = new TraktPagedParameters(PAGE, LIMIT);

            TraktPagedResponse <ITraktUserComment> response =
                await client.Comments.GetRecentlyUpdatedCommentsAsync(null, OBJECT_TYPE, true, null, pagedParameters);

            response.Should().NotBeNull();
            response.IsSuccess.Should().BeTrue();
            response.HasValue.Should().BeTrue();
            response.Value.Should().NotBeNull().And.HaveCount(COMMENTS_ITEM_COUNT);
            response.ItemCount.Should().HaveValue().And.Be(COMMENTS_ITEM_COUNT);
            response.Limit.Should().Be(LIMIT);
            response.Page.Should().Be(PAGE);
            response.PageCount.Should().HaveValue().And.Be(1);
        }
Пример #17
0
        public async Task Test_TraktShowsModule_GetMostCollectedShows_With_Page_Filtered()
        {
            TraktClient client = TestUtility.GetMockClient(
                $"{GET_MOST_COLLECTED_SHOWS_URI}?page={PAGE}&{FILTER}",
                MOST_COLLECTED_SHOWS_JSON, PAGE, 10, 1, ITEM_COUNT);

            var pagedParameters = new TraktPagedParameters(PAGE);

            TraktPagedResponse <ITraktMostPWCShow> response =
                await client.Shows.GetMostCollectedShowsAsync(null, null, FILTER, 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(10u);
            response.Page.Should().Be(PAGE);
            response.PageCount.Should().HaveValue().And.Be(1);
        }
        public async Task Test_TraktCommentsModule_GetRecentlyUpdatedComments_With_ExtendedInfo_And_Page()
        {
            TraktClient client = TestUtility.GetMockClient(
                $"{GET_COMMENTS_UPDATES_URI}?extended={EXTENDED_INFO}&page={PAGE}",
                COMMENTS_JSON, PAGE, 10, 1, COMMENTS_ITEM_COUNT);

            var pagedParameters = new TraktPagedParameters(PAGE);

            TraktPagedResponse <ITraktUserComment> response =
                await client.Comments.GetRecentlyUpdatedCommentsAsync(null, null, null, EXTENDED_INFO, pagedParameters);

            response.Should().NotBeNull();
            response.IsSuccess.Should().BeTrue();
            response.HasValue.Should().BeTrue();
            response.Value.Should().NotBeNull().And.HaveCount(COMMENTS_ITEM_COUNT);
            response.ItemCount.Should().HaveValue().And.Be(COMMENTS_ITEM_COUNT);
            response.Limit.Should().Be(10u);
            response.Page.Should().Be(PAGE);
            response.PageCount.Should().HaveValue().And.Be(1);
        }
Пример #19
0
        public async Task Test_TraktShowsModule_GetMostCollectedShows_With_Period_And_Page_And_Limit()
        {
            TraktClient client = TestUtility.GetMockClient(
                $"{GET_MOST_COLLECTED_SHOWS_URI}/{TIME_PERIOD.UriName}?page={PAGE}&limit={LIMIT}",
                MOST_COLLECTED_SHOWS_JSON, PAGE, LIMIT, 1, ITEM_COUNT);

            var pagedParameters = new TraktPagedParameters(PAGE, LIMIT);

            TraktPagedResponse <ITraktMostPWCShow> response =
                await client.Shows.GetMostCollectedShowsAsync(TIME_PERIOD, null, 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);
        }
        public async Task Test_TraktCommentsModule_GetRecentlyUpdatedComments_With_Limit()
        {
            TraktClient client = TestUtility.GetMockClient(
                $"{GET_COMMENTS_UPDATES_URI}?limit={LIMIT}",
                COMMENTS_JSON, 1, LIMIT, 1, COMMENTS_ITEM_COUNT);

            var pagedParameters = new TraktPagedParameters(null, LIMIT);

            TraktPagedResponse <ITraktUserComment> response =
                await client.Comments.GetRecentlyUpdatedCommentsAsync(null, null, null, null, pagedParameters);

            response.Should().NotBeNull();
            response.IsSuccess.Should().BeTrue();
            response.HasValue.Should().BeTrue();
            response.Value.Should().NotBeNull().And.HaveCount(COMMENTS_ITEM_COUNT);
            response.ItemCount.Should().HaveValue().And.Be(COMMENTS_ITEM_COUNT);
            response.Limit.Should().Be(LIMIT);
            response.Page.Should().Be(1u);
            response.PageCount.Should().HaveValue().And.Be(1);
        }
Пример #21
0
        public async Task Test_TraktSyncModule_GetRatings_With_Page_And_Limit()
        {
            TraktClient client = TestUtility.GetOAuthMockClient(
                $"{GET_RATINGS_URI}?page={PAGE}&limit={LIMIT}",
                RATINGS_JSON, 1, 10, 1, RATINGS_ITEM_COUNT);

            var pagedParameters = new TraktPagedParameters(PAGE, LIMIT);

            TraktPagedResponse <ITraktRatingsItem> response =
                await client.Sync.GetRatingsAsync(null, null, null, pagedParameters);

            response.Should().NotBeNull();
            response.IsSuccess.Should().BeTrue();
            response.HasValue.Should().BeTrue();
            response.Value.Should().NotBeNull().And.HaveCount(4);
            response.ItemCount.Should().HaveValue().And.Be(RATINGS_ITEM_COUNT);
            response.Limit.Should().Be(10u);
            response.Page.Should().Be(1u);
            response.PageCount.Should().HaveValue().And.Be(1);
        }
Пример #22
0
        public async Task Test_TraktShowsModule_GetPopularShows_With_Page_And_Limit_Filtered()
        {
            TraktClient client = TestUtility.GetMockClient(
                $"{GET_POPULAR_SHOWS_URI}?page={PAGE}&limit={LIMIT}&{FILTER}",
                POPULAR_SHOWS_JSON, PAGE, LIMIT, 1, ITEM_COUNT);

            var pagedParameters = new TraktPagedParameters(PAGE, LIMIT);

            TraktPagedResponse <ITraktShow> response =
                await client.Shows.GetPopularShowsAsync(null, FILTER, 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);
        }
Пример #23
0
        public async Task Test_TraktShowsModule_GetShowLists_Complete()
        {
            TraktClient client = TestUtility.GetMockClient(
                $"{GET_SHOW_LISTS_URI}/{LIST_ITEM_TYPE.UriName}/{LIST_SORT_ORDER.UriName}?page={PAGE}&limit={LIMIT}",
                SHOW_LISTS_JSON, PAGE, LIMIT, 1, LISTS_ITEM_COUNT);

            var pagedParameters = new TraktPagedParameters(PAGE, LIMIT);

            TraktPagedResponse <ITraktList> response =
                await client.Shows.GetShowListsAsync(SHOW_ID, LIST_ITEM_TYPE, LIST_SORT_ORDER, pagedParameters);

            response.Should().NotBeNull();
            response.IsSuccess.Should().BeTrue();
            response.HasValue.Should().BeTrue();
            response.Value.Should().NotBeNull().And.HaveCount(LISTS_ITEM_COUNT);
            response.ItemCount.Should().HaveValue().And.Be(LISTS_ITEM_COUNT);
            response.Limit.Should().Be(LIMIT);
            response.Page.Should().Be(PAGE);
            response.PageCount.Should().HaveValue().And.Be(1);
        }
Пример #24
0
        public async Task Test_TraktShowsModule_GetShowRelatedShows_Complete()
        {
            TraktClient client = TestUtility.GetMockClient(
                $"{GET_SHOW_RELATED_SHOWS_URI}?extended={EXTENDED_INFO}&page={PAGE}&limit={RELATED_SHOWS_LIMIT}",
                SHOW_RELATED_SHOWS_JSON, PAGE, RELATED_SHOWS_LIMIT, 1, ITEM_COUNT);

            var pagedParameters = new TraktPagedParameters(PAGE, RELATED_SHOWS_LIMIT);

            TraktPagedResponse <ITraktShow> response =
                await client.Shows.GetShowRelatedShowsAsync(SHOW_ID, 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(RELATED_SHOWS_LIMIT);
            response.Page.Should().Be(PAGE);
            response.PageCount.Should().HaveValue().And.Be(1);
        }
Пример #25
0
        public async Task Test_TraktUsersModule_GetHiddenItems_With_Limit()
        {
            TraktClient client = TestUtility.GetOAuthMockClient(
                $"{GetHiddenItemsUri}?limit={HIDDEN_ITEMS_LIMIT}",
                HIDDEN_ITEMS_JSON, 1, HIDDEN_ITEMS_LIMIT, 1, HIDDEN_ITEMS_COUNT);

            var pagedParameters = new TraktPagedParameters(null, HIDDEN_ITEMS_LIMIT);

            TraktPagedResponse <ITraktUserHiddenItem> response =
                await client.Users.GetHiddenItemsAsync(HIDDEN_ITEMS_SECTION, null, null, pagedParameters);

            response.Should().NotBeNull();
            response.IsSuccess.Should().BeTrue();
            response.HasValue.Should().BeTrue();
            response.Value.Should().NotBeNull().And.HaveCount(HIDDEN_ITEMS_COUNT);
            response.ItemCount.Should().HaveValue().And.Be(HIDDEN_ITEMS_COUNT);
            response.Limit.Should().Be(HIDDEN_ITEMS_LIMIT);
            response.Page.Should().Be(1u);
            response.PageCount.Should().HaveValue().And.Be(1);
        }
        public async Task Test_TraktUsersModule_GetComments_With_ObjectType_And_ExtendedInfo_And_Limit()
        {
            TraktClient client = TestUtility.GetMockClient(
                $"{GET_COMMENTS_URI}/{OBJECT_TYPE.UriName}?extended={EXTENDED_INFO}&limit={COMMENTS_LIMIT}",
                USER_COMMENTS_JSON, 1, COMMENTS_LIMIT, 1, COMMENTS_ITEM_COUNT);

            var pagedParameters = new TraktPagedParameters(null, COMMENTS_LIMIT);

            TraktPagedResponse <ITraktUserComment> response =
                await client.Users.GetCommentsAsync(USERNAME, null, OBJECT_TYPE, null, EXTENDED_INFO, pagedParameters);

            response.Should().NotBeNull();
            response.IsSuccess.Should().BeTrue();
            response.HasValue.Should().BeTrue();
            response.Value.Should().NotBeNull().And.HaveCount(COMMENTS_ITEM_COUNT);
            response.ItemCount.Should().HaveValue().And.Be(COMMENTS_ITEM_COUNT);
            response.Limit.Should().Be(COMMENTS_LIMIT);
            response.Page.Should().Be(1u);
            response.PageCount.Should().HaveValue().And.Be(1);
        }
Пример #27
0
        public async Task Test_TraktSyncModule_GetWatchlist()
        {
            TraktClient client = TestUtility.GetOAuthMockClient(
                GET_WATCHLIST_URI,
                WATCHLIST_JSON, 1, 10, 1, ITEM_COUNT,
                sortBy: WATCHLIST_SORT_BY, sortHow: WATCHLIST_SORT_HOW);

            TraktPagedResponse <ITraktWatchlistItem> response = await client.Sync.GetWatchlistAsync();

            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);
            response.SortBy.Should().NotBeNull().And.Be(WATCHLIST_SORT_BY);
            response.SortHow.Should().NotBeNull().And.Be(WATCHLIST_SORT_HOW);
        }
        public async Task Test_TraktUsersModule_GetComments_With_Page_And_Limit()
        {
            TraktClient client = TestUtility.GetMockClient(
                $"{GET_COMMENTS_URI}?page={PAGE}&limit={COMMENTS_LIMIT}",
                USER_COMMENTS_JSON, PAGE, COMMENTS_LIMIT, 1, COMMENTS_ITEM_COUNT);

            var pagedParameters = new TraktPagedParameters(PAGE, COMMENTS_LIMIT);

            TraktPagedResponse <ITraktUserComment> response =
                await client.Users.GetCommentsAsync(USERNAME, null, null, null, null, pagedParameters);

            response.Should().NotBeNull();
            response.IsSuccess.Should().BeTrue();
            response.HasValue.Should().BeTrue();
            response.Value.Should().NotBeNull().And.HaveCount(COMMENTS_ITEM_COUNT);
            response.ItemCount.Should().HaveValue().And.Be(COMMENTS_ITEM_COUNT);
            response.Limit.Should().Be(COMMENTS_LIMIT);
            response.Page.Should().Be(PAGE);
            response.PageCount.Should().HaveValue().And.Be(1);
        }
Пример #29
0
        public async Task Test_TraktShowsModule_GetMostAnticipatedShows_With_Limit()
        {
            TraktClient client = TestUtility.GetMockClient(
                $"{GET_MOST_ANTICIPATED_SHOWS_URI}?limit={LIMIT}",
                MOST_ANTICIPATED_SHOWS_JSON, 1, LIMIT, 1, ITEM_COUNT);

            var pagedParameters = new TraktPagedParameters(null, LIMIT);

            TraktPagedResponse <ITraktMostAnticipatedShow> response =
                await client.Shows.GetMostAnticipatedShowsAsync(null, 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(1u);
            response.PageCount.Should().HaveValue().And.Be(1);
        }
        public async Task Test_TraktUsersModule_GetListComments_With_SortOrder_And_Page()
        {
            TraktClient client = TestUtility.GetMockClient(
                $"{GET_LIST_COMMENTS_URI}/{COMMENT_SORT_ORDER.UriName}?page={PAGE}",
                LIST_COMMENTS_JSON, PAGE, 10, 1, LIST_COMMENTS_ITEM_COUNT);

            var pagedParameters = new TraktPagedParameters(PAGE);

            TraktPagedResponse <ITraktComment> response =
                await client.Users.GetListCommentsAsync(USERNAME, LIST_ID, COMMENT_SORT_ORDER, pagedParameters);

            response.Should().NotBeNull();
            response.IsSuccess.Should().BeTrue();
            response.HasValue.Should().BeTrue();
            response.Value.Should().NotBeNull().And.HaveCount(LIST_COMMENTS_ITEM_COUNT);
            response.ItemCount.Should().HaveValue().And.Be(LIST_COMMENTS_ITEM_COUNT);
            response.Limit.Should().Be(10u);
            response.Page.Should().Be(PAGE);
            response.PageCount.Should().HaveValue().And.Be(1);
        }