Exemplo n.º 1
0
        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 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));
        }