public async Task GivenAReferenceSearchParam_WhenSearched_ThenCorrectBundleShouldBeReturned(string query, params int[] matchIndices) { Bundle bundle = await _client.SearchAsync(ResourceType.Patient, $"{query}&_tag={_fixture.FixtureTag}"); Patient[] expected = matchIndices.Select(i => _fixture.Patients[i]).ToArray(); ImportTestHelper.VerifyBundle(bundle, expected); }
public async Task GivenAQuantitySearchParameterWithQuantity_WhenSearched_ThenCorrectBundleShouldBeReturned(string queryValue, params int[] expectedIndices) { Bundle bundle = await _client.SearchAsync(ResourceType.Observation, $"value-quantity={queryValue}&_tag={_fixture.FixtureTag}"); Observation[] expected = expectedIndices.Select(i => _fixture.Observations[i]).ToArray(); ImportTestHelper.VerifyBundle(bundle, expected); }
public async Task GivenAUriSearchParam_WhenSearched_ThenCorrectBundleShouldBeReturned(string modifier, string queryValue, params int[] expectedIndices) { Bundle bundle = await _client.SearchAsync(ResourceType.ValueSet, $"url{modifier}={HttpUtility.UrlEncode(queryValue)}&_tag={_fixture.FixtureTag}"); ValueSet[] expected = expectedIndices.Select(i => _fixture.ValueSets[i]).ToArray(); ImportTestHelper.VerifyBundle(bundle, expected); }
private async Task SearchAndValidateObservations(string queryValue, string[] expectedObservationNames) { Bundle bundle = await SearchAsync(ResourceType.Observation, queryValue); Observation[] expected = expectedObservationNames.Select(name => _fixture.Observations[name]).ToArray(); ImportTestHelper.VerifyBundle(bundle, expected); }
private async Task SearchAndValidateDocumentReferences(string queryValue, string[] expectedDocumentReferenceNames) { Bundle bundle = await SearchAsync(ResourceType.DocumentReference, queryValue); DocumentReference[] expected = expectedDocumentReferenceNames.Select(name => _fixture.DocumentReferences[name]).ToArray(); ImportTestHelper.VerifyBundle(bundle, expected); }
public async Task GivenANumberSearchParam_WhenSearched_ThenCorrectBundleShouldBeReturned(string queryValue, params int[] expectedIndices) { Bundle bundle = await _client.SearchAsync(ResourceType.RiskAssessment, $"probability={queryValue}&_tag={_fixture.FixtureTag}"); RiskAssessment[] expected = expectedIndices.Select(i => _fixture.RiskAssessments[i]).ToArray(); ImportTestHelper.VerifyBundle(bundle, expected); }
public async Task GivenMultipleTokenSearchParametersWithNotModifiers_WhenSearched_ThenCorrectBundleShouldBeReturned(string queryValue, params int[] excludeIndices) { Bundle bundle = await _client.SearchAsync(ResourceType.Observation, $"category:not=test&value-concept:not={queryValue}&_tag={_fixture.FixtureTag}"); Observation[] expected = _fixture.Observations.Where((_, i) => !excludeIndices.Contains(i)).ToArray(); ImportTestHelper.VerifyBundle(bundle, expected); }
public async Task GivenATokenSearchParameterWithNotModifier_WhenSearchedOverMissingValue_ThenCorrectBundleShouldBeReturned() { Bundle bundle = await _client.SearchAsync(ResourceType.Observation, $"category:not=test&_tag={_fixture.FixtureTag}"); Observation[] expected = _fixture.Observations.Where((_, i) => i != 8).ToArray(); ImportTestHelper.VerifyBundle(bundle, expected); }
public async Task GivenIdWithNotModifier_WhenSearched_ThenCorrectBundleShouldBeReturned(int count) { Bundle bundle = await _client.SearchAsync(ResourceType.Observation, $"_id:not={string.Join(",", _fixture.Observations.Take(count).Select(x => x.Id))}&_tag={_fixture.FixtureTag}"); Observation[] expected = _fixture.Observations.Skip(count).ToArray(); ImportTestHelper.VerifyBundle(bundle, expected); }
public async Task GivenAStringSearchParamAndAResourceWithALongSearchParamValue_WhenSearched_ThenCorrectBundleShouldBeReturned(string modifier, string valueToSearch, bool shouldMatch) { string query = string.Format("address-city{0}={1}&_tag={2}", modifier, valueToSearch, _fixture.FixtureTag); Bundle bundle = await _client.SearchAsync(ResourceType.Patient, query); Assert.NotNull(bundle); Patient expectedPatient = _fixture.Patients[3]; if (shouldMatch) { Assert.NotEmpty(bundle.Entry); ImportTestHelper.VerifyBundle(bundle, expectedPatient); } else { Assert.Empty(bundle.Entry); } }
public async Task GivenAStringSearchParamWithMultipleValues_WhenSearched_ThenCorrectBundleShouldBeReturned() { Bundle bundle = await _client.SearchAsync(ResourceType.Patient, $"family=Smith,Ander&_tag={_fixture.FixtureTag}"); ImportTestHelper.VerifyBundle(bundle, _fixture.Patients[0], _fixture.Patients[2]); }
public async Task GivenAEscapedStringSearchParams_WhenSearched_ThenCorrectBundleShouldBeReturned() { Bundle bundle = await _client.SearchAsync(ResourceType.Patient, $"name=Richard\\,Muller&_tag={_fixture.FixtureTag}"); ImportTestHelper.VerifyBundle(bundle, _fixture.Patients[7]); }
public async Task GivenAStringSearchParamThatCoversSeveralFields_WhenSpecifiedTwiceInASearch_IntersectsTheTwoResultsProperly() { Bundle bundle = await _client.SearchAsync(ResourceType.Patient, $"name=Bea&name=Smith&_tag={_fixture.FixtureTag}"); ImportTestHelper.VerifyBundle(bundle, _fixture.Patients[0]); }
public async Task GivenTypeWithNotModifier_WhenSearched_ThenCorrectBundleShouldBeReturned(params ResourceType[] resourceTypes) { Bundle bundle = await _client.SearchAsync($"?_tag={_fixture.FixtureTag}&_type:not={string.Join(",", resourceTypes)}"); ImportTestHelper.VerifyBundle(bundle, _fixture.Observations.ToArray()); }