Esempio n. 1
0
        public static Argument Create(F.SearchParamType type, bool fuzzy = false)
        {
            switch (type)
            {
            case F.SearchParamType.Number:
                return(new IntArgument());

            case F.SearchParamType.String:
                return(new StringArgument());

            case F.SearchParamType.Date:
                return(new DateArgument());

            case F.SearchParamType.Token:
                return(new TokenArgument());

            case F.SearchParamType.Reference:
                return(new ReferenceArgument());

            case F.SearchParamType.Composite:
                //TODO: Implement Composite arguments
                return(new Argument());

            default:
                return(new Argument());
            }
        }
Esempio n. 2
0
 private SearchParameterInfo CreateSearchParameter(SearchParamType searchParameterType)
 {
     return(new SearchParameter
     {
         Name = DefaultParamName,
         Type = searchParameterType,
     }.ToInfo());
 }
Esempio n. 3
0
        public void GivenASearchParameterThatDoesNotSupportTextModifier_WhenBuilt_ThenCorrectExpressionShouldBeCreated(SearchParamType searchParameterType)
        {
            var searchParameter = new SearchParameter
            {
                Name = "test",
                Code = "test",
                Type = searchParameterType,
            };

            Assert.Throws <InvalidSearchOperationException>(() => _parser.Parse(searchParameter.ToInfo(), new SearchModifier(SearchModifierCode.Text), "test"));
        }
Esempio n. 4
0
 public void GivenMultipleValuesWithPrefix_WhenBuilding_ThenInvalidSearchOperationExceptionShouldBeThrown(SearchParamType searchParameterType, string value)
 {
     // Parse the expression.
     Assert.Throws <InvalidSearchOperationException>(() => _parser.Parse(
                                                         CreateSearchParameter(searchParameterType),
                                                         null,
                                                         value));
 }