public async Task DocumentOperationGETReturn200OnSuccess()
        {
            // Setup Composition resource
            var composition  = CreateTestCompositionNoReferences();
            var searchResult = new SearchResult(new List <IResource>()
            {
                composition
            }, 1, 1);

            _searchMock.Setup(repo => repo.Search(It.IsAny <IArgumentCollection>(), It.IsAny <SearchOptions>())).ReturnsAsync(searchResult);

            // Create VonkContext for $document (GET / Instance level)
            var testContext = new VonkTestContext(VonkInteraction.instance_custom);

            testContext.Arguments.AddArguments(new[]
            {
                new Argument(ArgumentSource.Path, ArgumentNames.resourceType, "Composition"),
                new Argument(ArgumentSource.Path, ArgumentNames.resourceId, "test")
            });
            testContext.TestRequest.CustomOperation = "document";
            testContext.TestRequest.Method          = "GET";

            // Execute $document
            await _documentService.DocumentInstanceGET(testContext);

            // Check response status
            testContext.Response.HttpResult.Should().Be(StatusCodes.Status200OK, "$document should succeed with HTTP 200 - OK on test composition");
            testContext.Response.Payload.Should().NotBeNull();
            var bundleType = testContext.Response.Payload.SelectText("type");

            bundleType.Should().Be("document", "Bundle.type should be set to 'document'");
        }
        public async Task DocumentOperationShouldPersistBundle()
        {
            // Setup Composition resource
            var composition  = CreateTestCompositionNoReferences();
            var searchResult = new SearchResult(new List <IResource>()
            {
                composition
            }, 1, 1);

            _searchMock.Setup(repo => repo.Search(It.IsAny <IArgumentCollection>(), It.IsAny <SearchOptions>())).ReturnsAsync(searchResult);

            // Create VonkContext for $document (GET / Instance level)
            var testContext = new VonkTestContext(VonkInteraction.instance_custom);

            testContext.Arguments.AddArguments(new[]
            {
                new Argument(ArgumentSource.Path, ArgumentNames.resourceType, "Composition"),
                new Argument(ArgumentSource.Path, ArgumentNames.resourceId, "test"),
                new Argument(ArgumentSource.Query, "persist", "true")
            });
            testContext.TestRequest.CustomOperation = "document";
            testContext.TestRequest.Method          = "GET";

            // Execute $document
            await _documentService.DocumentInstanceGET(testContext);

            _changeMock.Verify(c => c.Create(It.IsAny <IResource>()), Times.Once);
        }
        public async Task DocumentOperationInternalServerErrorOnExternalReference()
        {
            // Setup Composition resource
            var composition             = CreateTestCompositionAbsoulteReferences(); // External reference (patient resource) in the composition resource
            var compositionSearchResult = new SearchResult(new List <IResource>()
            {
                composition
            }, 1, 1);

            _searchMock.Setup(repo => repo.Search(It.Is <IArgumentCollection>(arg => arg.GetArgument("_type").ArgumentValue.Equals("Composition")), It.IsAny <SearchOptions>())).ReturnsAsync(compositionSearchResult);

            // Create VonkContext for $document (GET / Instance level)
            var testContext = new VonkTestContext(VonkInteraction.instance_custom);

            testContext.Arguments.AddArguments(new[]
            {
                new Argument(ArgumentSource.Path, ArgumentNames.resourceType, "Composition"),
                new Argument(ArgumentSource.Path, ArgumentNames.resourceId, "test")
            });
            testContext.TestRequest.CustomOperation = "document";
            testContext.TestRequest.Method          = "GET";

            // Execute $document
            await _documentService.DocumentInstanceGET(testContext);

            // Check response status
            testContext.Response.HttpResult.Should().Be(StatusCodes.Status500InternalServerError, "$document should return HTTP 500 - Internal Server error when an external reference is referenced by the composition");
            testContext.Response.Outcome.Issues.Should().Contain(issue => issue.IssueType.Equals(VonkOutcome.IssueType.NotSupported), "OperationOutcome should highlight that this feature is not supported");
        }
        public async Task DocumentOperationInternalServerErrorOnMissingReference1()
        {
            var resourceToBeFound = new List <string> {
                "Composition"
            };

            // Setup Composition resource
            var composition             = CreateTestCompositionInclPatient(); // Unresolvable reference (patient resource) in the composition resource (1. level)
            var compositionSearchResult = new SearchResult(new List <IResource>()
            {
                composition
            }, 1, 1);

            _searchMock.Setup(repo => repo.Search(It.Is <IArgumentCollection>(arg => arg.GetArgument("_type").ArgumentValue.Equals("Composition")), It.IsAny <SearchOptions>())).ReturnsAsync(compositionSearchResult);
            _searchMock.Setup(repo => repo.Search(It.Is <IArgumentCollection>(arg => !resourceToBeFound.Contains(arg.GetArgument("_type").ArgumentValue)), It.IsAny <SearchOptions>())).ReturnsAsync(new SearchResult(Enumerable.Empty <IResource>(), 0, 0)); // -> GetBeyKey returns null

            // Create VonkContext for $document (GET / Instance level)
            var testContext = new VonkTestContext(VonkInteraction.instance_custom);

            testContext.Arguments.AddArguments(new[]
            {
                new Argument(ArgumentSource.Path, ArgumentNames.resourceType, "Composition"),
                new Argument(ArgumentSource.Path, ArgumentNames.resourceId, "test")
            });
            testContext.TestRequest.CustomOperation = "document";
            testContext.TestRequest.Method          = "GET";

            // Execute $document
            await _documentService.DocumentInstanceGET(testContext);

            // Check response status
            testContext.Response.HttpResult.Should().Be(StatusCodes.Status500InternalServerError, "$document should return HTTP 500 - Internal Server error when a reference which is referenced by the composition can't be resolved");
            testContext.Response.Outcome.Issues.Should().Contain(issue => issue.IssueType.Equals(VonkOutcome.IssueType.NotFound), "OperationOutcome should explicitly mention that the reference could not be found");
        }
        public async Task DocumentOperationPOSTReturn400OnMissingId()
        {
            // Setup Composition resource
            var composition  = CreateTestCompositionNoReferences();
            var searchResult = new SearchResult(new List <IResource>()
            {
                composition
            }, 1, 1);

            _searchMock.Setup(repo => repo.Search(It.IsAny <IArgumentCollection>(), It.IsAny <SearchOptions>())).ReturnsAsync(searchResult);

            // Create VonkContext for $document (POST / Type level)
            var testContext = new VonkTestContext(VonkInteraction.instance_custom);

            testContext.Arguments.AddArguments(new[]
            {
                new Argument(ArgumentSource.Path, ArgumentNames.resourceType, "Composition")
            });
            testContext.TestRequest.CustomOperation = "document";
            testContext.TestRequest.Method          = "POST";
            testContext.TestRequest.Payload         = new RequestPayload(true, new Parameters().ToIResource()); // Call with empty parameters

            // Execute $document
            await _documentService.DocumentTypePOST(testContext);

            // Check response status
            testContext.Response.HttpResult.Should().Be(StatusCodes.Status400BadRequest, "$document should fail with HTTP 400 - Bad request if Parameters resource does not contain an id");
            testContext.Response.Outcome.Should().NotBeNull("At least one OperationOutcome should be returned");
            testContext.Response.Outcome.Issues.Should().Contain(issue => issue.IssueType.Equals(VonkOutcome.IssueType.Invalid), "Request should be rejected as an invalid request");
        }
        public async Task DocumentOperationGETReturn404MissingComposition()
        {
            // Let ISearchRepository return no Composition
            var composition  = CreateTestCompositionNoReferences();
            var searchResult = new SearchResult(new List <IResource>(), 0, 0);

            _searchMock.Setup(repo => repo.Search(It.IsAny <IArgumentCollection>(), It.IsAny <SearchOptions>())).ReturnsAsync(searchResult);

            // Create VonkContext for $document (GET / Instance level)
            var testContext = new VonkTestContext(VonkInteraction.instance_custom);

            testContext.Arguments.AddArguments(new[]
            {
                new Argument(ArgumentSource.Path, ArgumentNames.resourceType, "Composition"),
                new Argument(ArgumentSource.Path, ArgumentNames.resourceId, "test")
            });
            testContext.TestRequest.CustomOperation = "document";
            testContext.TestRequest.Method          = "GET";

            // Execute $document without creating a Composition first
            await _documentService.DocumentInstanceGET(testContext);

            // Check response status
            testContext.Response.HttpResult.Should().Be(StatusCodes.Status404NotFound, "$document should return HTTP 404 - Not found when called on a missing composition");
        }
        public async Task DocumentOperationCanIncludeCustomResources()
        {
            var composition             = CreateTestCompositionInclCustomResource();
            var compositionSearchResult = new SearchResult(new List <IResource>()
            {
                composition
            }, 1, 1);

            var customResourceTest = SourceNode.Resource("CustomBasic", "CustomBasic");

            customResourceTest.Add(SourceNode.Valued("id", Guid.NewGuid().ToString()));

            var customResourceSearchResults = new SearchResult(new List <IResource> {
                customResourceTest.ToIResource(VonkConstants.Model.FhirR3)
            }, 1, 1);

            _searchMock.Setup(repo => repo.Search(It.Is <IArgumentCollection>(arg => arg.GetArgument("_type").ArgumentValue.Equals("Composition")), It.IsAny <SearchOptions>())).ReturnsAsync(compositionSearchResult);
            _searchMock.Setup(repo => repo.Search(It.Is <IArgumentCollection>(arg => arg.GetArgument("_type").ArgumentValue.Equals("CustomBasic")), It.IsAny <SearchOptions>())).ReturnsAsync(customResourceSearchResults);

            var testContext = new VonkTestContext(VonkInteraction.instance_custom);

            testContext.Arguments.AddArguments(new[]
            {
                new Argument(ArgumentSource.Path, ArgumentNames.resourceType, "Composition"),
                new Argument(ArgumentSource.Path, ArgumentNames.resourceId, "test")
            });
            testContext.TestRequest.CustomOperation = "document";
            testContext.TestRequest.Method          = "GET";

            await _documentService.DocumentInstanceGET(testContext);

            testContext.Response.HttpResult.Should().Be(StatusCodes.Status200OK, "$document should return HTTP 200 - OK when all references in the composition (incl. recursive references) can be resolved");
            testContext.Response.Payload.SelectNodes("entry.resource").Count().Should().Be(2, "Expected Composition and CustomBasic to be in the document");
        }
示例#8
0
        public async Task PatientBundleContainsIdentifier()
        {
            // Setup Composition resource
            var composition  = CreateTestPatientNoReferences();
            var searchResult = new SearchResult(new List <IResource>()
            {
                composition
            }, 1, 1);

            _searchMock.Setup(repo => repo.Search(It.IsAny <IArgumentCollection>(), It.IsAny <SearchOptions>())).ReturnsAsync(searchResult);

            // Create VonkContext for $everything (GET / Instance level)
            var testContext = new VonkTestContext(VonkInteraction.instance_custom);

            testContext.Arguments.AddArguments(new[]
            {
                new Argument(ArgumentSource.Path, ArgumentNames.resourceType, "Composition"),
                new Argument(ArgumentSource.Path, ArgumentNames.resourceId, "test")
            });
            testContext.TestRequest.CustomOperation = "everything";
            testContext.TestRequest.Method          = "GET";

            // Execute $everything
            await _everythingService.PatientInstanceGET(testContext);

            testContext.Response.HttpResult.Should().Be(StatusCodes.Status200OK, "$everythingt should succeed with HTTP 200 - OK on test patient");
            testContext.Response.Payload.Should().NotBeNull();

            var identifier = testContext.Response.Payload.SelectNodes("identifier");

            identifier.Should().NotBeEmpty("A Patient SHALL contain at least one identifier");
        }
示例#9
0
        public async Task PatientOperationGETReturn200OnSuccess()
        {
            // Setup Patient resource
            var    patient    = CreateTestPatientNoReferences();
            string patientStr = FhirAsJsonString(patient);

            var searchResult = new SearchResult(new List <IResource>()
            {
                patient
            }, 1, 1);

            _searchMock.Setup(repo => repo.Search(It.IsAny <IArgumentCollection>(), It.IsAny <SearchOptions>())).ReturnsAsync(searchResult);

            // Create VonkContext for $everything (GET / Instance level)
            var testContext = new VonkTestContext(VonkInteraction.instance_custom);

            testContext.Arguments.AddArguments(new[]
            {
                new Argument(ArgumentSource.Path, ArgumentNames.resourceType, "Patient"),
                new Argument(ArgumentSource.Path, ArgumentNames.resourceId, "test")
            });
            testContext.TestRequest.CustomOperation = "everything";
            testContext.TestRequest.Method          = "GET";


            VonkCompartmentDefinition componentDefinition = new VonkCompartmentDefinition()
            {
                CompartmentType = ResourceType.Patient.ToString(), InformationModel = patient.InformationModel
            };

            List <VonkCompartmentDefinition> vonkCompartmentDefinitionList = new List <VonkCompartmentDefinition>()
            {
                componentDefinition
            };
            //IModelService modelService = new IModelService() testContext.InformationModel, testContext.InformationModel, new List<string> { ResourceType.Patient.ToString() },
            //    new Dictionary<string, string>(), new List<VonkSearchParameter>(), vonkCompartmentDefinitionList);

            // Execute $everything
            await _everythingService.PatientInstanceGET(testContext);

            // Check response status
            testContext.Response.HttpResult.Should().Be(StatusCodes.Status200OK, "$everything should succeed with HTTP 200 - OK on test patient");
            testContext.Response.Payload.Should().NotBeNull();
            var bundleType = testContext.Response.Payload.SelectText("type");

            bundleType.Should().Be("searchset", "Bundle.type should be set to 'searchset'");
            var bundle = testContext.Response.Payload.ToPoco <Bundle>();

            bundle.Entry.Count.Should().Be(1);
            bundle.Entry[0].Resource.ResourceType.Should().Be(ResourceType.Patient);
            string bundleStr = FhirAsJsonString(testContext.Response.Payload);
        }
示例#10
0
//        [Fact]
        public async Task EverythingOperationInternalServerErrorOnMissingReference3()
        {
            var resourceToBeFound = new List <string> {
                "Patient", "Organization", "Practitioner"
            };

            // Setup Patient resource
            var patient             = CreateTestIncOrginizationAndPractitioner(); // Unresolvable reference (Practitioner resource) in Patient resource (3. level)
            var patientSearchResult = new SearchResult(new List <IResource>()
            {
                patient
            }, 1, 1);
            var patString = FhirAsJsonString(patient);

            var organization = CreateTestOrganization();
            var organizationSearchResults = new SearchResult(new List <IResource> {
                organization
            }, 1, 1);

            var practitioner             = CreateTestPractitioner("missingId");
            var practitionerSearchResult = new SearchResult(new List <IResource>()
            {
                practitioner
            }, 1, 1);
            var pracString = FhirAsJsonString(practitioner);

            _searchMock.Setup(repo => repo.Search(It.Is <IArgumentCollection>(arg => arg.GetArgument("_type").ArgumentValue.Equals("Patient")), It.IsAny <SearchOptions>())).ReturnsAsync(patientSearchResult);
            _searchMock.Setup(repo => repo.Search(It.Is <IArgumentCollection>(arg => arg.GetArgument("_type").ArgumentValue.Equals("Organization")), It.IsAny <SearchOptions>())).ReturnsAsync(organizationSearchResults);
            _searchMock.Setup(repo => repo.Search(It.Is <IArgumentCollection>(arg => arg.GetArgument("_type").ArgumentValue.Equals("Practitioner")), It.IsAny <SearchOptions>())).ReturnsAsync(practitionerSearchResult);
            _searchMock.Setup(repo => repo.Search(It.Is <IArgumentCollection>(arg => !resourceToBeFound.Contains(arg.GetArgument("_type").ArgumentValue)), It.IsAny <SearchOptions>())).ReturnsAsync(new SearchResult(Enumerable.Empty <IResource>(), 0, 0)); // -> GetBeyKey returns null

            // Create VonkContext for $everything (GET / Instance level)
            var testContext = new VonkTestContext(VonkInteraction.instance_custom);

            testContext.Arguments.AddArguments(new[]
            {
                new Argument(ArgumentSource.Path, ArgumentNames.resourceType, "Patient"),
                new Argument(ArgumentSource.Path, ArgumentNames.resourceId, "test")
            });
            testContext.TestRequest.CustomOperation = "everything";
            testContext.TestRequest.Method          = "GET";

            // Execute $everything
            await _everythingService.PatientInstanceGET(testContext);

            // Check response status
            testContext.Response.HttpResult.Should().Be(StatusCodes.Status500InternalServerError, "$everything should return HTTP 500 - Internal Server error when a reference which is referenced by the composition can't be resolved");
            testContext.Response.Outcome.Issues.Should().Contain(issue => issue.IssueType.Equals(VonkOutcome.IssueType.NotFound), "OperationOutcome should explicitly mention that the reference could not be found");
        }
        public async Task DocumentOperationSuccessCompleteComposition()
        {
            // Setup Composition resource
            var composition             = CreateTestCompositionInclList();
            var compositionSearchResult = new SearchResult(new List <IResource>()
            {
                composition
            }, 1, 1);

            var list = CreateTestList();
            var listSearchResults = new SearchResult(new List <IResource> {
                list
            }, 1, 1);

            var medcationStatement             = CreateTestMedicationStatement();
            var medcationStatementSearchResult = new SearchResult(new List <IResource>()
            {
                medcationStatement
            }, 1, 1);

            var medication             = CreateTestMedication();
            var medicationSearchResult = new SearchResult(new List <IResource> {
                medication
            }, 1, 1);

            _searchMock.Setup(repo => repo.Search(It.Is <IArgumentCollection>(arg => arg.GetArgument("_type").ArgumentValue.Equals("Composition")), It.IsAny <SearchOptions>())).ReturnsAsync(compositionSearchResult);
            _searchMock.Setup(repo => repo.Search(It.Is <IArgumentCollection>(arg => arg.GetArgument("_type").ArgumentValue.Equals("List")), It.IsAny <SearchOptions>())).ReturnsAsync(listSearchResults);
            _searchMock.Setup(repo => repo.Search(It.Is <IArgumentCollection>(arg => arg.GetArgument("_type").ArgumentValue.Equals("MedicationStatement")), It.IsAny <SearchOptions>())).ReturnsAsync(medcationStatementSearchResult);
            _searchMock.Setup(repo => repo.Search(It.Is <IArgumentCollection>(arg => arg.GetArgument("_type").ArgumentValue.Equals("Medication")), It.IsAny <SearchOptions>())).ReturnsAsync(medcationStatementSearchResult);

            // Create VonkContext for $document (GET / Instance level)
            var testContext = new VonkTestContext(VonkInteraction.instance_custom);

            testContext.Arguments.AddArguments(new[]
            {
                new Argument(ArgumentSource.Path, ArgumentNames.resourceType, "Composition"),
                new Argument(ArgumentSource.Path, ArgumentNames.resourceId, "test")
            });
            testContext.TestRequest.CustomOperation = "document";
            testContext.TestRequest.Method          = "GET";

            // Execute $document
            await _documentService.DocumentInstanceGET(testContext);

            // Check response status
            testContext.Response.HttpResult.Should().Be(StatusCodes.Status200OK, "$document should return HTTP 200 - OK when all references in the composition (incl. recursive references) can be resolved");
            testContext.Response.Payload.SelectNodes("entry.resource").Count().Should().Be(4, "Expected Composition, List, MedicationStatement and Medication resources to be in the document");
        }
示例#12
0
        public async Task EverythingOperationSuccessCompletePatientReferences()
        {
            // Setup Patient resource
            var patient             = CreateTestIncOrginizationAndPractitioner();
            var patientSearchResult = new SearchResult(new List <IResource>()
            {
                patient
            }, 1, 1);

            var organization            = CreateTestOrganization();
            var orginzationSearchResult = new SearchResult(new List <IResource>()
            {
                organization
            }, 1, 1);

            var practitioner             = CreateTestPractitioner();
            var practitionerSearchResult = new SearchResult(new List <IResource> {
                practitioner
            }, 1, 1);

            _searchMock.Setup(repo => repo.Search(It.Is <IArgumentCollection>(arg => arg.GetArgument("_type").ArgumentValue.Equals("Patient")), It.IsAny <SearchOptions>())).ReturnsAsync(patientSearchResult);
            _searchMock.Setup(repo => repo.Search(It.Is <IArgumentCollection>(arg => arg.GetArgument("_type").ArgumentValue.Equals("Organization")), It.IsAny <SearchOptions>())).ReturnsAsync(orginzationSearchResult);
            _searchMock.Setup(repo => repo.Search(It.Is <IArgumentCollection>(arg => arg.GetArgument("_type").ArgumentValue.Equals("Practitioner")), It.IsAny <SearchOptions>())).ReturnsAsync(practitionerSearchResult);

            // Create VonkContext for $everything (GET / Instance level)
            var testContext = new VonkTestContext(VonkInteraction.instance_custom);

            testContext.Arguments.AddArguments(new[]
            {
                new Argument(ArgumentSource.Path, ArgumentNames.resourceType, "Patient"),
                new Argument(ArgumentSource.Path, ArgumentNames.resourceId, "test")
            });
            testContext.TestRequest.CustomOperation = "everything";
            testContext.TestRequest.Method          = "GET";

            // Execute $everything
            await _everythingService.PatientInstanceGET(testContext);

            // Check response status
            testContext.Response.HttpResult.Should().Be(StatusCodes.Status200OK, "$everything should return HTTP 200 - OK when all references in the patient (incl. recursive references) can be resolved");
            testContext.Response.Payload.SelectNodes("entry.resource").Count().Should().Be(3, "Expected Patient, Organization and Practitioner resources to be in the everything");
            var resources = testContext.Response.Payload.SelectNodes("entry");

            resources.Select(r => r.SelectNodes("resourceType").Equals(ResourceType.Patient)).Should().NotBeEmpty();
            resources.Select(r => r.SelectNodes("resourceType").Equals(ResourceType.Organization)).Should().NotBeEmpty();
            resources.Select(r => r.SelectNodes("resourceType").Equals(ResourceType.Practitioner)).Should().NotBeEmpty();
        }
        public async Task DocumentOperationPOSTReturn200OnSuccess()
        {
            // Setup Composition resource
            var composition   = CreateTestCompositionNoReferences();
            var compositionId = "test";
            var searchResult  = new SearchResult(new List <IResource>()
            {
                composition
            }, 1, 1);

            _searchMock.Setup(repo => repo.Search(
                                  It.Is <IArgumentCollection>(args => args.GetArgument(ArgumentNames.resourceId).ArgumentValue == compositionId),
                                  It.IsAny <SearchOptions>())).ReturnsAsync(searchResult);

            // Create VonkContext for $document (POST / Type level)
            var testContext = new VonkTestContext(VonkInteraction.instance_custom);

            testContext.Arguments.AddArguments(new[]
            {
                new Argument(ArgumentSource.Path, ArgumentNames.resourceType, "Composition")
            });
            testContext.TestRequest.CustomOperation = "document";
            testContext.TestRequest.Method          = "POST";

            var parameters         = new Parameters();
            var idValue            = new FhirUri(compositionId);
            var parameterComponent = new Parameters.ParameterComponent {
                Name = "id"
            };

            parameterComponent.Value = idValue;
            parameters.Parameter.Add(parameterComponent);

            testContext.TestRequest.Payload = new RequestPayload(true, parameters.ToIResource());

            // Execute $document
            await _documentService.DocumentTypePOST(testContext);

            // Check response status
            testContext.Response.HttpResult.Should().Be(StatusCodes.Status200OK, "$document should succeed with HTTP 200 - OK on test composition");
            testContext.Response.Payload.Should().NotBeNull();
            var bundleType = testContext.Response.Payload.SelectText("type");

            bundleType.Should().Be("document", "Bundle.type should be set to 'document'");
        }
示例#14
0
        public async Task TestOperationTypeLevelShouldSucceed()
        {
            // Create VonkContext for $test (POST / Type level)
            var testContext = new VonkTestContext(VonkInteraction.instance_custom);

            testContext.Arguments.AddArguments(new[]
            {
                new Argument(ArgumentSource.Path, ArgumentNames.resourceType, "Patient"),
            });
            testContext.TestRequest.CustomOperation = "test";
            testContext.TestRequest.Method          = "POST";

            // Execute $document
            await _testOperationService.Test(testContext);

            // Check response
            testContext.Response.HttpResult.Should().Be(StatusCodes.Status200OK, "$test should succeed");
            testContext.Response.Outcome.Issues.Count().Should().Be(1, "An OperationOutcome should be included in the response");
            testContext.Response.Outcome.IssuesWithSeverity(IssueSeverity.Information).Count().Should().Be(1, "The OperationOutcome should be informational, not an error");
        }
示例#15
0
        public async Task EverythingOperationGETReturn200OnSuccess()
        {
            // Create VonkContext for $everything (GET / Instance level)
            var testContext = new VonkTestContext(VonkInteraction.instance_custom);

            // Setup Patient resource
            var    patient    = CreateTestPatientNoReferences();
            string patientStr = FhirAsJsonString(patient);

            var account = CreateTestAccountForPatient();

            var searchOptions   = SearchOptions.Latest(testContext.ServerBase, testContext.Request.Interaction, testContext.InformationModel);
            var patSearchResult = new SearchResult(new List <IResource>()
            {
                patient
            }, 1, 1);
            var searchArgs = new ArgumentCollection(
                new Argument(ArgumentSource.Internal, ArgumentNames.resourceType, patient.GetResourceTypeIndicator())
            {
                MustHandle = true
            },
                new Argument(ArgumentSource.Internal, ArgumentNames.resourceId, $"{patient.Id}")
            {
                MustHandle = true
            }
                );

            _searchMock.Setup(repo => repo.Search(searchArgs, searchOptions)).ReturnsAsync(patSearchResult);

            var acctsearchResult = new SearchResult(new List <IResource>()
            {
                account
            }, 1, 1);

            searchArgs = new ArgumentCollection(
                new Argument(ArgumentSource.Internal, ArgumentNames.resourceType, account.GetResourceTypeIndicator())
            {
                MustHandle = true
            },
                new Argument(ArgumentSource.Internal, "subject", $"Patient/{patient.Id}")
            {
                MustHandle = true
            }
                );

            _searchMock.Setup(repo => repo.Search(searchArgs, searchOptions)).ReturnsAsync(acctsearchResult);

            testContext.Arguments.AddArguments(new[]
            {
                new Argument(ArgumentSource.Path, ArgumentNames.resourceType, "Patient"),
                new Argument(ArgumentSource.Path, ArgumentNames.resourceId, "test")
            });
            testContext.TestRequest.CustomOperation = "everything";
            testContext.TestRequest.Method          = "GET";

            // Execute $everything
            await _everythingService.PatientInstanceGET(testContext);

            // Check response status
            testContext.Response.HttpResult.Should().Be(StatusCodes.Status200OK, "$everything should succeed with HTTP 200 - OK on test patient");
            testContext.Response.Payload.Should().NotBeNull();
            var bundleType = testContext.Response.Payload.SelectText("type");

            bundleType.Should().Be("searchset", "Bundle.type should be set to 'searchset'");
            var bundle = testContext.Response.Payload.ToPoco <Bundle>();

            bundle.Entry.Count.Should().Be(1);
            bundle.Entry[0].Resource.ResourceType.Should().Be(ResourceType.Patient);
            string bundleStr = FhirAsJsonString(testContext.Response.Payload);
        }