Beispiel #1
0
        public async Task Test_TraktCheckinsModule_DeleteAnyActiveCheckins()
        {
            TraktClient            client   = TestUtility.GetOAuthMockClient(CHECKIN_URI, HttpStatusCode.NoContent);
            TraktNoContentResponse response = await client.Checkins.DeleteAnyActiveCheckinsAsync();

            response.IsSuccess.Should().BeTrue();
        }
Beispiel #2
0
        public async Task Test_TraktCommentsModule_UnlikeComment()
        {
            TraktClient            client   = TestUtility.GetOAuthMockClient(UNLIKE_COMMENT_URI, HttpStatusCode.NoContent);
            TraktNoContentResponse response = await client.Comments.UnlikeCommentAsync(COMMENT_ID);

            response.IsSuccess.Should().BeTrue();
        }
        public async Task Test_TraktUsersModule_DeleteCustomList()
        {
            TraktClient            client   = TestUtility.GetOAuthMockClient(DELETE_CUSTOM_LIST_URI, HttpStatusCode.NoContent);
            TraktNoContentResponse response = await client.Users.DeleteCustomListAsync(USERNAME, LIST_ID);

            response.Should().NotBeNull();
            response.IsSuccess.Should().BeTrue();
        }
        public async Task Test_TraktRecommendationsModule_HideMovieRecommendation()
        {
            TraktClient            client   = TestUtility.GetOAuthMockClient(HIDE_MOVIE_RECOMMENDATION_URI, HttpStatusCode.NoContent);
            TraktNoContentResponse response = await client.Recommendations.HideMovieRecommendationAsync(MOVIE_ID);

            response.Should().NotBeNull();
            response.IsSuccess.Should().BeTrue();
        }
        public async Task Test_TraktUsersModule_DenyFollowRequest()
        {
            TraktClient            client   = TestUtility.GetOAuthMockClient(DENY_FOLLOW_REQUEST_URI, HttpStatusCode.NoContent);
            TraktNoContentResponse response = await client.Users.DenyFollowRequestAsync(REQUEST_ID);

            response.Should().NotBeNull();
            response.IsSuccess.Should().BeTrue();
        }
        public async Task Test_TraktUsersModule_UnfollowUser()
        {
            TraktClient            client   = TestUtility.GetOAuthMockClient(UNFOLLOW_USER_URI, HttpStatusCode.NoContent);
            TraktNoContentResponse response = await client.Users.UnfollowUserAsync(USERNAME);

            response.Should().NotBeNull();
            response.IsSuccess.Should().BeTrue();
        }
        public async Task Test_TraktSyncModule_RemovePlaybackItem()
        {
            TraktClient            client   = TestUtility.GetOAuthMockClient(REMOVE_PLAYBACK_ITEM_URI, HttpStatusCode.NoContent);
            TraktNoContentResponse response = await client.Sync.RemovePlaybackItemAsync(PLAYBACK_ID);

            response.Should().NotBeNull();
            response.IsSuccess.Should().BeTrue();
        }
        public async Task Test_TraktAuthenticationModule_RevokeAuthorization_With_Token_And_ClientId_And_ClientSecret()
        {
            TraktClient client = TestUtility.GetAuthenticationMockClient(REVOKE_AUTHORIZATION_URI, MockAuthorizationRevokePostContent);

            client.Authorization = MockAuthorization;
            TraktNoContentResponse response = await client.Authentication.RevokeAuthorizationAsync(TestConstants.MOCK_ACCESS_TOKEN, TraktClientId, TraktClientSecret);

            response.Should().NotBeNull();
            response.IsSuccess.Should().BeTrue();

            ITraktAuthorization authorization = client.Authorization;

            authorization.Should().NotBeNull();
            authorization.AccessToken.Should().NotBeNull().And.BeEmpty();
            authorization.RefreshToken.Should().NotBeNull().And.BeEmpty();
            authorization.Scope.Should().Be(TraktAccessScope.Public);
            authorization.TokenType.Should().Be(TraktAccessTokenType.Bearer);
            authorization.CreatedAt.Should().BeCloseTo(DateTime.UtcNow, CLOSE_TO_PRECISION);
            authorization.ExpiresInSeconds.Should().Be(7776000U);
            authorization.IsExpired.Should().BeTrue();
            authorization.IsRefreshPossible.Should().BeFalse();
            authorization.IsValid.Should().BeFalse();
        }
        public async Task Test_TraktAuthenticationModule_RevokeAuthorization()
        {
            TraktClient client = TestUtility.GetAuthenticationMockClient(REVOKE_AUTHORIZATION_URI, MockAuthorizationRevokePostContent);

            client.Authorization = MockAuthorization;
            TraktNoContentResponse response = await client.Authentication.RevokeAuthorizationAsync();

            response.Should().NotBeNull();
            response.IsSuccess.Should().BeTrue();

            ITraktAuthorization authorization = client.Authorization;

            authorization.Should().NotBeNull();
            authorization.AccessToken.Should().NotBeNull().And.BeEmpty();
            authorization.RefreshToken.Should().NotBeNull().And.BeEmpty();
            authorization.Scope.Should().Be(TraktAccessScope.Public);
            authorization.TokenType.Should().Be(TraktAccessTokenType.Bearer);
            authorization.CreatedAt.Should().BeCloseTo(DateTime.UtcNow, TimeSpan.FromSeconds(3600));
            authorization.ExpiresInSeconds.Should().Be(7776000U);
            authorization.IsExpired.Should().BeTrue();
            authorization.IsRefreshPossible.Should().BeFalse();
            authorization.IsValid.Should().BeFalse();
        }