public async void GetAllAsync_CalledWithId_ReturnsListOfComments() { //Given var client = new Mock <IRestClient>(); var response = new TicketCommentListResponse { Results = new List <TicketComment> { new TicketComment { Id = 123 } } }; client.Setup(c => c.GetAsync <TicketCommentListResponse>( It.IsAny <Uri>(), It.IsAny <string>(), It.IsAny <string>())) .Returns(TaskHelper.CreateTaskFromResult(response)); var resource = new TicketCommentResource(client.Object); //When var result = await resource.GetAllAsync(123); //Then Assert.Equal(result, response); }
public void GetAll_CalledWithId_ReturnsListOfComments() { //Given var response = new TicketCommentListResponse { Results = new List <TicketComment> { new TicketComment { Id = 123 } } }; _client.Setup(c => c.Get <TicketCommentListResponse>( It.IsAny <Uri>(), It.IsAny <string>(), It.IsAny <string>())) .Returns(response); var resource = new TicketCommentResource(_client.Object); //When var result = resource.GetAll(123); //Then Assert.That(result, Is.EqualTo(response)); }
public void GetAll_Called_UrlIsCorrect() { //Given _client.Setup(c => c.Get<TicketCommentListResponse>(It.IsAny<Uri>())).Returns(new TicketCommentListResponse()); var resource = new TicketCommentResource(_client.Object); //When resource.GetAll(123); //Then _client.Verify(c => c.BuildUri(It.Is<string>(u => u.Contains("tickets/123/comments")), It.IsAny<string>())); }
public void GetAll_Called_UrlIsCorrect() { //Given _client.Setup(c => c.Get <TicketCommentListResponse>(It.IsAny <Uri>())).Returns(new TicketCommentListResponse()); var resource = new TicketCommentResource(_client.Object); //When resource.GetAll(123); //Then _client.Verify(c => c.BuildUri(It.Is <string>(u => u.Contains("tickets/123/comments")), It.IsAny <string>())); }
public ZendeskClient(Uri baseUri, ZendeskDefaultConfiguration configuration, ISerializer serializer = null, IHttpChannel httpChannel = null, ILogAdapter logger = null) :base(baseUri, configuration, serializer, httpChannel, logger) { Tickets = new TicketResource(this); TicketComments = new TicketCommentResource(this); Organizations = new OrganizationResource(this); Search = new SearchResource(this); Groups = new GroupsResource(this); AssignableGroups = new AssignableGroupResource(this); Users = new UserResource(this); UserIdentities = new UserIdentityResource(this); OrganizationMemberships = new OrganizationMembershipResource(this); }
public ZendeskClient(Uri baseUri, ZendeskDefaultConfiguration configuration, ISerializer serializer = null, IHttpChannel httpChannel = null, ILogAdapter logger = null) : base(baseUri, configuration, serializer, httpChannel, logger) { Tickets = new TicketResource(this); TicketComments = new TicketCommentResource(this); Organizations = new OrganizationResource(this); Search = new SearchResource(this); Groups = new GroupsResource(this); AssignableGroups = new AssignableGroupResource(this); Users = new UserResource(this); UserIdentities = new UserIdentityResource(this); OrganizationMemberships = new OrganizationMembershipResource(this); }
public async void GetAllAsync_Called_UrlIsCorrect() { //Given var response = new TicketCommentListResponse(); _client.Setup(c => c.GetAsync <TicketCommentListResponse>(It.IsAny <Uri>(), It.IsAny <string>(), It.IsAny <string>())).Returns(TaskHelper.CreateTaskFromResult(response)); var resource = new TicketCommentResource(_client.Object); //When await resource.GetAllAsync(123); //Then _client.Verify(c => c.BuildUri(It.Is <string>(u => u.Contains("tickets/123/comments")), It.IsAny <string>())); }
public void GetAll_CalledWithId_ReturnsListOfComments() { //Given var listOfTicketComments = new TicketCommentListResponse { Results = new List<TicketComment> { new TicketComment { Id = 123 } } }; _client.Setup(c => c.Get<TicketCommentListResponse>(It.IsAny<Uri>())).Returns(listOfTicketComments); var resource = new TicketCommentResource(_client.Object); //When var result = resource.GetAll(123); //Then Assert.That(result, Is.EqualTo(listOfTicketComments)); }
public async void GetAllAsync_CalledWithId_ReturnsListOfComments() { //Given var response = new TicketCommentListResponse { Results = new List<TicketComment> { new TicketComment { Id = 123 } } }; _client.Setup(c => c.GetAsync<TicketCommentListResponse>( It.IsAny<Uri>(), It.IsAny<string>(), It.IsAny<string>())) .Returns(TaskHelper.CreateTaskFromResult(response)); var resource = new TicketCommentResource(_client.Object); //When var result = await resource.GetAllAsync(123); //Then Assert.That(result, Is.EqualTo(response)); }
public async void GetAllAsync_Called_UrlIsCorrect() { //Given var response = new TicketCommentListResponse(); _client.Setup(c => c.GetAsync<TicketCommentListResponse>(It.IsAny<Uri>(), It.IsAny<string>(), It.IsAny<string>())).Returns(TaskHelper.CreateTaskFromResult(response)); var resource = new TicketCommentResource(_client.Object); //When await resource.GetAllAsync(123); //Then _client.Verify(c => c.BuildUri(It.Is<string>(u => u.Contains("tickets/123/comments")), It.IsAny<string>())); }