コード例 #1
0
        public void ApiException_Without_ErrorContent_Returns_NullRequestId()
        {
            var error         = new ApiException();
            var errorResponse = error.GetRequestId();

            Assert.That(errorResponse, Is.Null);
        }
コード例 #2
0
        public void ApiExceptionMalformedInsightsUrl_ReturnsNull_RequestId()
        {
            try
            {
                var _ = _factory.Api <PortfoliosApi>().GetPortfolio("doesnt", "exist");
            }
            catch (ApiException e)
            {
                var problemDetails = e.ProblemDetails();

                // Remove the InsightsURL which contains the requestId
                problemDetails.Instance = "";

                var apiExceptionMalformed = new ApiException(
                    errorCode: e.ErrorCode,
                    message: e.Message,
                    errorContent: JsonConvert.SerializeObject(problemDetails));

                var requestId = apiExceptionMalformed.GetRequestId();
                Assert.That(requestId, Is.Null);
            }
        }