public void CheckApiException() { Exception ex = new ApiException("Message", new Exception("Inner exception.")); Exception ex2 = new ApiException("Message"); string exceptionToString = ex.ToString(); Assert.AreEqual(exceptionToString, ex.ToString()); Assert.AreEqual(exceptionToString, ex2.ToString()); }
public void DoesNotThrowIfBodyIsNotDefined() { var response = CreateResponse(HttpStatusCode.GatewayTimeout); var exception = new ApiException(response); var stringRepresentation = exception.ToString(); Assert.NotNull(stringRepresentation); }
public void DoesNotPrintNonStringContent() { var responseBody = new byte[0]; var response = CreateResponse( HttpStatusCode.GatewayTimeout, responseBody); var exception = new ApiException(response); var stringRepresentation = exception.ToString(); Assert.NotNull(stringRepresentation); }
public void DoesNotThrowIfBodyIsNotDefined() { var response = new Response( HttpStatusCode.GatewayTimeout, null, new Dictionary <string, string>(), "application/json"); var exception = new ApiException(response); var stringRepresentation = exception.ToString(); Assert.NotNull(stringRepresentation); }
public void ContainsResponseBody() { const string responseBody = @"{""errors"":[{""code"":""custom"",""field"":""key"",""message"":""key is " + @"already in use"",""resource"":""PublicKey""}],""message"":""Validation Failed""}"; var response = CreateResponse( HttpStatusCode.GatewayTimeout, responseBody); var exception = new ApiException(response); var stringRepresentation = exception.ToString(); Assert.Contains(responseBody, stringRepresentation); }
public void DoesNotPrintNonStringContent() { var responceBody = new byte[0]; var response = new Response( HttpStatusCode.GatewayTimeout, responceBody, new Dictionary <string, string>(), "application/json"); var exception = new ApiException(response); var stringRepresentation = exception.ToString(); Assert.NotNull(stringRepresentation); }
public virtual bool Equals(ApiException exc) { return(exc != null && ToString().Equals(exc.ToString(), System.StringComparison.Ordinal)); }
public void DoesNotPrintNonStringContent() { var responceBody = new byte[0]; var response = new Response( HttpStatusCode.GatewayTimeout, responceBody, new Dictionary<string, string>(), "application/json" ); var exception = new ApiException(response); var stringRepresentation = exception.ToString(); Assert.NotNull(stringRepresentation); }
public void DoesNotThrowIfBodyIsNotDefined() { var response = new Response( HttpStatusCode.GatewayTimeout, null, new Dictionary<string, string>(), "application/json" ); var exception = new ApiException(response); var stringRepresentation = exception.ToString(); Assert.NotNull(stringRepresentation); }
public void ContainsResponseBody() { const string responseBody = @"{""errors"":[{""code"":""custom"",""field"":""key"",""message"":""key is " + @"already in use"",""resource"":""PublicKey""}],""message"":""Validation Failed""}"; var response = new Response( HttpStatusCode.GatewayTimeout, responseBody, new Dictionary<string, string>(), "application/json" ); var exception = new ApiException(response); var stringRepresentation = exception.ToString(); Assert.Contains(responseBody, stringRepresentation); }