public void StatusCode_TestWithResponse() { var response = new HttpResponseMessage(errorCode); var exception = new TestClientException(errorMessage, response); Assert.AreEqual(errorCode, exception.StatusCode); }
public void InnerException_TestWithRequestAndInnerException() { var innerException = new Exception("Inner exception message"); var exception = new TestClientException(errorMessage, new HttpRequestMessage(), errorCode, innerException); Assert.AreSame(innerException, exception.InnerException); }
public void ResponseContent_TestWithResponse() { var content = new StringContent("MockContent"); var response = new HttpResponseMessage() { Content = content, }; var exception = new TestClientException(errorMessage, response); Assert.IsNotNull(exception.ResponseContent); Assert.IsInstanceOfType(exception.ResponseContent, typeof(StringContent)); }
public void Message_TestWithRequest() { var requestMock = new Mock <HttpRequestMessage>(); requestMock .Setup(r => r.ToString()) .Returns("MockRequestToString"); var exception = new TestClientException(errorMessage, requestMock.Object, errorCode); exception.AssertMessageKeyAndValue("Message", errorMessage); exception.AssertMessageKeyAndValue("Request", "MockRequestToString"); exception.AssertMessageKeyAndValue("StatusCode", errorCode.ToString()); exception.AssertMissingMessageKey("Response"); exception.AssertMissingMessageKey("ResponseContent"); }
public void StatusCode_TestWithRequest() { var exception = new TestClientException(errorMessage, new HttpRequestMessage(), errorCode); Assert.AreEqual(errorCode, exception.StatusCode); }
public void ResponseContent_TestWithRequest() { var exception = new TestClientException(errorMessage, new HttpRequestMessage(), errorCode); Assert.IsNull(exception.ResponseContent); }