public void Put_HttpReturnsFailResult_ThrowsException() { // Given var http = new Mock <IHttpChannel>(); http.Setup(h => h.Put(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.Put <string>(new Uri("http://someurl.co.uk/resource"))); }
public void Put_Success_ReturnsSuccessResult() { // Given var http = new Mock <IHttpChannel>(); http.Setup(h => h.Put(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.Put <string>(new Uri("http://someurl.co.uk/resource")); // Then Assert.That(result, Is.EqualTo(_successResponse.Content)); }
public void Put_Success_ReturnsSuccessResult() { // Given var http = new Mock<IHttpChannel>(); http.Setup(h => h.Put(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.Put<string>(new Uri("http://someurl.co.uk/resource")); // Then Assert.That(result, Is.EqualTo(_successResponse.Content)); }
public void Put_HttpReturnsFailResult_ThrowsException() { // Given var http = new Mock<IHttpChannel>(); http.Setup(h => h.Put(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.Put<string>(new Uri("http://someurl.co.uk/resource"))); }