Ejemplo n.º 1
0
 internal static void SetBody(this Bundle.ResponseComponent interaction, byte[] data)
 {
     interaction.RemoveAnnotations <Body>();
     interaction.AddAnnotation(new Body {
         Data = data
     });
 }
        public void GivenARequestToCreateAPatient_WhenResponseIsOK_ThenResourceConflictExceptionShouldBeThrown()
        {
            var response = new Bundle.ResponseComponent();

            response.AddAnnotation(HttpStatusCode.OK);

            var context = new FhirTransactionContext(ChangeFeedGenerator.Generate());

            context.Request.Patient = FhirTransactionRequestEntryGenerator.GenerateDefaultCreateRequestEntry <Patient>();

            context.Response.Patient = new FhirTransactionResponseEntry(response, new Patient());

            Assert.Throws <ResourceConflictException>(() => _patientPipeline.ProcessResponse(context));
        }
        public void GivenARequestToUpdateAPatient_WhenResponseIsOK_ThenItShouldBeNoOp()
        {
            var response = new Bundle.ResponseComponent();

            response.AddAnnotation(HttpStatusCode.OK);

            var context = new FhirTransactionContext(ChangeFeedGenerator.Generate());

            context.Request.Patient = FhirTransactionRequestEntryGenerator.GenerateDefaultUpdateRequestEntry <Patient>(
                new ServerResourceId(ResourceType.Patient, "123"));

            context.Response.Patient = new FhirTransactionResponseEntry(response, new Patient());

            _patientPipeline.ProcessResponse(context);
        }