RetrieveGlobalStream() public method

Retrieves the global stream for the current AccessToken. NOTE: Unless changed by the postStreamGeneralParameters, only the latest 20 posts will be returned.
public RetrieveGlobalStream ( PostStreamGeneralParameters postStreamGeneralParameters = null ) : ResponseEnvelope>
postStreamGeneralParameters PostStreamGeneralParameters
return ResponseEnvelope>
Exemplo n.º 1
0
        public void PostsServiceCanRetrieveGlobalStreamFilteredByPostStreamGeneralParameters()
        {
            //Setup
            var postStreamGeneralParameters = new PostStreamGeneralParameters { IncludeUser = 1 };
            var apiCaller = A.Fake<IApiCaller>();
            var postsService = new PostsService(apiCaller);
            A.CallTo(apiCaller).WithReturnType<ResponseEnvelope<List<Post>>>().Returns(new ResponseEnvelope<List<Post>>
                                                                                           {
                                                                                               Data = new List<Post> { new Post { User = new User() } }
                                                                                           });

            //Execute
            var posts = postsService.RetrieveGlobalStream(postStreamGeneralParameters);

            //Verify
            posts.Data.ShouldNotBeNull();
            posts.Data.ShouldHaveCount(1);
            posts.Data[0].User.ShouldNotBeNull();

            //Teardown
        }
Exemplo n.º 2
0
        public void PostsServiceCanRetrieveGlobalStream()
        {
            //Setup
            var apiCaller = A.Fake<IApiCaller>();
            var postsService = new PostsService(apiCaller);
            A.CallTo(() => apiCaller.ApiGet<List<Post>>(PostsService.POSTS_ENDPOINT + PostsService.STREAM_ENDPOINT + PostsService.GLOBAL_ENDPOINT, null)).Returns(new ResponseEnvelope<List<Post>>
                                                                                                                                                                      {
                                                                                                                                                                          Data = new List<Post> { new Post() }
                                                                                                                                                                      });

            //Execute
            var posts = postsService.RetrieveGlobalStream();

            //Verify
            posts.Data.ShouldNotBeNull();
            posts.Data.ShouldHaveCount(1);

            //Teardown
        }