예제 #1
0
 private OperationOutcome GetOperationOutcome(SparkException exception)
 {
     if (exception == null)
     {
         return(null);
     }
     return((exception.Outcome ?? new OperationOutcome()).AddAllInnerErrors(exception));
 }
        private HttpResponseMessage InternalCreateHttpResponseMessage(SparkException exception, HttpRequestMessage request)
        {
            if (exception == null)
            {
                return(null);
            }

            OperationOutcome outcome = exception.Outcome ?? new OperationOutcome();

            outcome.AddAllInnerErrors(exception);
            return(request.CreateResponse(exception.StatusCode, outcome));;
        }
        public async Task ReadAsync_ThrowsSparkException_BadRequest_OnNonUtf8Content()
        {
            var formatter = GetInputFormatter();

            var content      = "ɊɋɌɍɎɏ";
            var contentBytes = Encoding.Unicode.GetBytes(content);

            var httpContext = GetHttpContext(contentBytes, DEFAULT_CONTENT_TYPE);

            var formatterContext = CreateInputFormatterContext(typeof(Resource), httpContext);

            SparkException exception = await Assert.ThrowsAsync <SparkException>(() => formatter.ReadAsync(formatterContext));

            Assert.Equal(HttpStatusCode.BadRequest, exception.StatusCode);
        }
예제 #4
0
 private static Hl7.Fhir.Model.OperationOutcome GetOperationOutcome(SparkException exception) =>
 exception == null
         ? null
         : (exception.Outcome ?? new Hl7.Fhir.Model.OperationOutcome()).AddAllInnerErrors(exception);