public void GivenAUriWithInvalidModifier_WhenBuilding_ThenInvalidSearchOperationExceptionShouldBeThrown(SearchModifierCode modifier) { Assert.Throws <InvalidSearchOperationException>( () => _parser.Parse(CreateSearchParameter(SearchParamType.Uri), modifier, "test")); }
public void GivenAReferenceWithInvalidModifier_WhenBuilding_ThenInvalidSearchOperationExceptionShouldBeThrown(SearchModifierCode modifier) { _referenceSearchValueParser.Parse(Arg.Any <string>()).Returns(new ReferenceSearchValue(ReferenceKind.InternalOrExternal, null, null, "123")); Assert.Throws <InvalidSearchOperationException>( () => _parser.Parse(CreateSearchParameter(SearchParamType.Reference), modifier, "Patient/test")); }
public void GivenACompositeWithInvalidModifier_WhenBuilding_ThenInvalidSearchOperationExceptionShouldBeThrown(SearchModifierCode modifier) { var quantityUri = new Uri("http://quantity"); SearchParameterInfo searchParameter = CreateCompositeSearchParameter( new SearchParameterComponentInfo(quantityUri), new SearchParameterComponentInfo(quantityUri)); _searchParameterDefinitionManager.GetSearchParameter(quantityUri).Returns( new SearchParameter { Name = "quantity", Type = SearchParamType.Quantity, }.ToInfo()); Assert.Throws <InvalidSearchOperationException>( () => _parser.Parse(CreateSearchParameter(SearchParamType.Composite), modifier, "10|s|c$10|s|c")); }
public void GivenACompositeWithInvalidModifier_WhenBuilding_ThenInvalidSearchOperationExceptionShouldBeThrown(SearchModifierCode modifier) { var quantityUri = new Uri("http://quantity"); SearchParameterComponentInfo[] components = new[] { new SearchParameterComponentInfo(quantityUri), new SearchParameterComponentInfo(quantityUri) }; var searchParameter1 = new SearchParameterInfo( DefaultParamName, Microsoft.Health.Fhir.ValueSets.SearchParamType.Composite, components: components); SearchParameterInfo searchParameter = searchParameter1; _searchParameterDefinitionManager.GetSearchParameter(quantityUri).Returns( new SearchParameter { Name = "quantity", Type = SearchParamType.Quantity, }.ToInfo()); Assert.Throws <InvalidSearchOperationException>( () => _parser.Parse(CreateSearchParameter(SearchParamType.Composite), modifier, "10|s|c$10|s|c")); }
public override string ToString() { return(SearchModifierCode == SearchModifierCode.Type ? ResourceType : SearchModifierCode.ToString()); }
public void GivenAUriWithInvalidModifier_WhenBuilding_ThenInvalidSearchOperationExceptionShouldBeThrown(SearchModifierCode modifier, ResourceType?targetTypeModifier = null) { Assert.Throws <InvalidSearchOperationException>( () => _parser.Parse(CreateSearchParameter(SearchParamType.Uri), new SearchModifier(modifier, targetTypeModifier?.ToString()), "test")); }