public RetrievePostsMentioningUser ( string userId, PostStreamGeneralParameters postStreamGeneralParameters = null ) : ResponseEnvelope
|
||
userId | string | May be a userId, Username, or "me" for the current user. |
postStreamGeneralParameters | PostStreamGeneralParameters | |
리턴 | ResponseEnvelope
|
public void PostsServiceCanRetrievePostsMentioningASpecficUserFilteredByPostStreamGeneralParameters() { //Setup const string userId = "1"; var postStreamGeneralParameters = new PostStreamGeneralParameters { Count = 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 { Entities = new Entities { Mentions = new List<Mention> { new Mention { Id = "1" } } } } } }); //Execute var posts = postsService.RetrievePostsMentioningUser(userId, postStreamGeneralParameters); //Verify posts.Data.ShouldNotBeNull(); posts.Data.Count.ShouldEqual(postStreamGeneralParameters.Count); foreach (var post in posts.Data) { post.Entities.ShouldNotBeNull(); post.Entities.Mentions.ShouldNotBeNull(); post.Entities.Mentions.Count.ShouldBeGreaterThan(0); post.Entities.Mentions[0].Id.ShouldNotBeNull(); post.Entities.Mentions[0].Id.ShouldEqual(userId); } //Teardown }
public void PostsServiceCanRetrievePostsMentioningASpecficUser() { //Setup const string userId = "1"; var apiCaller = A.Fake<IApiCaller>(); var postsService = new PostsService(apiCaller); A.CallTo(() => apiCaller.ApiGet<List<Post>>(UsersService.USERS_ENDPOINT + userId + "/" + PostsService.MENTIONS_ENDPOINT, null)) .Returns(new ResponseEnvelope<List<Post>> { Data = new List<Post> { new Post { Entities = new Entities { Mentions = new List<Mention> { new Mention { Id = "1" } } } } } }); //Execute var posts = postsService.RetrievePostsMentioningUser(userId); //Verify posts.ShouldNotBeNull(); foreach (var post in posts.Data) { post.Entities.ShouldNotBeNull(); post.Entities.Mentions.ShouldNotBeNull(); post.Entities.Mentions.Count.ShouldBeGreaterThan(0); post.Entities.Mentions[0].Id.ShouldNotBeNull(); post.Entities.Mentions[0].Id.ShouldEqual(userId); } //Teardown }