RetrievePostsStarredByUser() 공개 메소드

Retrieves a list of posts starred by a given userId.
public RetrievePostsStarredByUser ( string userId, PostStreamGeneralParameters postStreamGeneralParameters = null ) : ResponseEnvelope>
userId string May be a userId, Username, or "me" for the current user.
postStreamGeneralParameters PostStreamGeneralParameters
리턴 ResponseEnvelope>
        public void PostsServiceCanListPostsStarredByAUser()
        {
            //Setup
            const string userId = "me";
            var restSharpApiCaller = new RestSharpApiCaller(ACCESS_TOKEN);
            var postsService = new PostsService(restSharpApiCaller);

            //Execute
            var starredPosts = postsService.RetrievePostsStarredByUser(userId);

            //Verify
            starredPosts.Data.ShouldNotBeNull();
            starredPosts.Data.Count.ShouldBeGreaterThan(0);
            foreach (var post in starredPosts.Data)
            {
                post.YouStarred.HasValue.ShouldBeTrue();
                // ReSharper disable PossibleInvalidOperationException
                post.YouStarred.Value.ShouldBeTrue();
                // ReSharper restore PossibleInvalidOperationException
            }

            //Teardown
        }
예제 #2
0
        public void PostsServiceCanRetrievePostsStarredByAUser()
        {
            //Setup
            const string userId = "me";
            var apiCaller = A.Fake<IApiCaller>();
            var postsService = new PostsService(apiCaller);
            A.CallTo(() => apiCaller.ApiGet<List<Post>>(UsersService.USERS_ENDPOINT + userId + "/" + PostsService.STARS_ACTION, null))
                .Returns(new ResponseEnvelope<List<Post>>
                             {
                                 Data = new List<Post> { new Post { YouStarred = true } }
                             });

            //Execute
            var posts = postsService.RetrievePostsStarredByUser(userId);

            //Verify
            posts.Data.ShouldNotBeNull();
            posts.Data.ShouldHaveCount(1);
            posts.Data.First().YouStarred.HasValue.ShouldBeTrue();
            // ReSharper disable PossibleInvalidOperationException
            posts.Data.First().YouStarred.Value.ShouldBeTrue();
            // ReSharper restore PossibleInvalidOperationException

            //Teardown
        }