public void Get_HttpReturnsFailResult_ThrowsException()
        {
            // Given
            var http = new Mock<IHttpChannel>();
            http.Setup(h => h.Get(It.IsAny<IHttpRequest>()))
                .Returns(_failureResponse);

            var client = new ZendeskClient(new Uri("http://someurl.co.uk"), new ZendeskDefaultConfiguration("bob", "x1234//#"), _serializer.Object, http.Object);

            // When, Then
            Assert.Throws<HttpException>(() => client.Get<string>(new Uri("http://someurl.co.uk/resource")));
        }
        public void Get_HttpReturnsFailResult_ThrowsException()
        {
            // Given
            var http = new Mock <IHttpChannel>();

            http.Setup(h => h.Get(It.IsAny <IHttpRequest>(), It.IsAny <string>(), It.IsAny <string>()))
            .Returns(_failureResponse);

            var client = new ZendeskClient(new Uri("http://someurl.co.uk"), new ZendeskDefaultConfiguration("bob", "x1234//#"), _serializer.Object, http.Object);

            // When, Then
            Assert.Throws <HttpException>(() => client.Get <string>(new Uri("http://someurl.co.uk/resource")));
        }
        public void Get_Success_ReturnsSuccessResult()
        {
            // Given
            var http = new Mock<IHttpChannel>();
            http.Setup(h => h.Get(It.IsAny<IHttpRequest>()))
                .Returns(_successResponse);

            var client = new ZendeskClient(new Uri("http://someurl.co.uk"), new ZendeskDefaultConfiguration("bob", "x1234//#"), _serializer.Object, http.Object);

            // When
            var result = client.Get<string>(new Uri("http://someurl.co.uk/resource"));

            // Then
            Assert.That(result, Is.EqualTo(_successResponse.Content));
        }
        public void Get_Success_ReturnsSuccessResult()
        {
            // Given
            var http = new Mock <IHttpChannel>();

            http.Setup(h => h.Get(It.IsAny <IHttpRequest>(), It.IsAny <string>(), It.IsAny <string>()))
            .Returns(_successResponse);

            var client = new ZendeskClient(new Uri("http://someurl.co.uk"), new ZendeskDefaultConfiguration("bob", "x1234//#"), _serializer.Object, http.Object);

            // When
            var result = client.Get <string>(new Uri("http://someurl.co.uk/resource"));

            // Then
            Assert.That(result, Is.EqualTo(_successResponse.Content));
        }