Exemplo n.º 1
0
        private bool TryParseSingleEnum <EnumType>(KeyValuePair <string, StringValues> Item, out EnumType EnumValue)
            where EnumType : Enum
        {
            if (!IsParameterValueEmpty(Item))
            {
                CheckSingleParameterForMoreThanOne(Item);
                string Value      = Item.Value[Item.Value.Count - 1];
                string ValueLower = StringSupport.ToLowerFast(Value);
                var    Dic        = StringToEnumMap <EnumType> .GetDictionary();

                if (Dic.ContainsKey(ValueLower))
                {
                    EnumValue = Dic[ValueLower];
                    return(true);
                }
                else
                {
                    this.InvalidParameterList.Add(new InvalidSearchQueryParameter(Item.Key, Value, $"Unable to parse the provided value to an allowed value."));
                }
            }
#pragma warning disable CS8653 // A default expression introduces a null value for a type parameter.
            EnumValue = default;
#pragma warning restore CS8653 // A default expression introduces a null value for a type parameter.
            return(false);
        }
        private bool ParseModifierType(ISearchParameterBase SearchParameter, string value)
        {
            var    SearchModifierTypeDic = FhirSearchEnum.GetSearchModifierTypeDictionary();
            string ValueCaseCorrectly    = StringSupport.ToLowerFast(value);

            if (SearchModifierTypeDic.ContainsKey(ValueCaseCorrectly))
            {
                SearchParameter.Modifier = SearchModifierTypeDic[ValueCaseCorrectly];
                return(true);
            }
            else
            {
                string TypedResourceName = value;
                if (value.Contains("."))
                {
                    char[] delimiters = { '.' };
                    TypedResourceName = value.Split(delimiters)[0].Trim();
                }

                Type ResourceType = ModelInfo.GetTypeForFhirType(TypedResourceName);
                if (ResourceType != null && ModelInfo.IsKnownResource(ResourceType))
                {
                    SearchParameter.TypeModifierResource = TypedResourceName;
                    SearchParameter.Modifier             = Hl7.Fhir.Model.SearchParameter.SearchModifierCode.Type;
                    return(true);
                }
                return(false);
            }
        }
Exemplo n.º 3
0
        public IDtoRootUrlStore SetPrimaryRootUrlStore(string RootUrl)
        {
            RootUrl = StringSupport.ToLowerFast(RootUrl.StripHttp());
            _ServiceBaseUrl ExsistingPrimaryRootURL = this.GetPrimaryPyro_RootUrlStore();

            if (ExsistingPrimaryRootURL != null)
            {
                ExsistingPrimaryRootURL.IsServersPrimaryUrlRoot = false;
            }
            _ServiceBaseUrl ExsistingNonPrimaryRootURL = this.GetPyro_RootUrlStore(RootUrl);

            if (ExsistingNonPrimaryRootURL != null)
            {
                ExsistingNonPrimaryRootURL.IsServersPrimaryUrlRoot = true;
            }
            else
            {
                _ServiceBaseUrl Pyro_RootUrlStore = new _ServiceBaseUrl();
                Pyro_RootUrlStore.IsServersPrimaryUrlRoot = true;
                Pyro_RootUrlStore.Url = RootUrl;
                IPyroDbContext.Set <_ServiceBaseUrl>().Add(Pyro_RootUrlStore);
            }
            this.Save();
            return(this.GetPrimaryRootUrlStore());
        }
        private static async Task Send(string text)
        {
            var stopwatch = new Stopwatch();

            #region ["Send A Simple Msg"]
            Message simpleMessage = new Message
            {
                Body = StringSupport.GetBytes(text)
            };

            stopwatch.Start();
            // Send the message on the request queue.
            await mSimple.SendAsync(simpleMessage);

            stopwatch.Stop();

            Console.WriteLine("---");
            Console.WriteLine("Simple Msg: {0} ms.", stopwatch.ElapsedMilliseconds);


            #endregion


            #region ["Send Req-Resp Msg"]
            // Create a session identifyer for the response message
            string responseSessionId = Guid.NewGuid().ToString();

            // Create a message using text as the body.
            Message requestMessage = new Message
            {
                SessionId        = responseSessionId,
                Body             = StringSupport.GetBytes(text),
                ReplyToSessionId = responseSessionId
            };
            Console.WriteLine("---");
            Console.WriteLine("Sending request to RequestQueue for processing...");

            stopwatch.Start();
            // Send the message on the request queue.
            await mSender.SendAsync(requestMessage);

            // Accept a session message.
            var responseSession = await mSessionRecvr.AcceptMessageSessionAsync(responseSessionId);

            Message responseMessage = await responseSession.ReceiveAsync();

            stopwatch.Stop();

            await responseSession.CloseAsync();

            #endregion

            // Deserialise the message body to echoText.
            string echoText = StringSupport.GetString(responseMessage.Body);


            Console.WriteLine("Response rcvd from Server.");
            Console.WriteLine(echoText);
            Console.WriteLine("Req-Resp (Total) Time: {0} ms.", stopwatch.ElapsedMilliseconds);
        }
Exemplo n.º 5
0
        public virtual void ParseModifier(string parameterName, IResourceTypeSupport IResourceTypeSupport, IKnownResource IKnownResource)
        {
            if (parameterName.Contains(FhirSearchQuery.TermSearchModifierDelimiter))
            {
                string parameterNameModifierPart = parameterName.Split(FhirSearchQuery.TermSearchModifierDelimiter)[1];
                var    SearchModifierTypeDic     = StringToEnumMap <Common.Enums.SearchModifierCode> .GetDictionary();

                string ValueCaseCorrectly = StringSupport.ToLowerFast(parameterNameModifierPart);
                if (SearchModifierTypeDic.ContainsKey(ValueCaseCorrectly))
                {
                    this.Modifier = SearchModifierTypeDic[ValueCaseCorrectly];
                }
                else
                {
                    string TypedResourceName = parameterNameModifierPart;
                    if (parameterNameModifierPart.Contains("."))
                    {
                        char[] delimiters = { '.' };
                        TypedResourceName = parameterNameModifierPart.Split(delimiters)[0].Trim();
                    }

                    if (IKnownResource.IsKnownResource(this.FhirVersionId, TypedResourceName))
                    {
                        Common.Enums.ResourceType?ResourceType = IResourceTypeSupport.GetTypeFromName(TypedResourceName);
                        if (ResourceType != null)
                        {
                            this.TypeModifierResource = ResourceType.Value;
                            this.Modifier             = SearchModifierCode.Type;
                        }
                        else
                        {
                            throw new ApplicationException($"Found a known resource to the FHIR API yet this resource was not found in the Enum list for {typeof(Common.Enums.ResourceType).Name}");
                        }
                    }
                    else
                    {
                        this.InvalidMessage = $"Unable to parse the given search parameter's Modifier: {parameterName}, ";
                        this.IsValid        = false;
                    }
                }
            }
            else
            {
                this.Modifier             = null;
                this.TypeModifierResource = null;
            }

            if (this.Modifier.HasValue)
            {
                SearchModifierCode[] oSupportedModifierArray = SearchQuerySupport.GetModifiersForSearchType(this.SearchParamTypeId);
                if (!oSupportedModifierArray.Any(x => x == this.Modifier.Value))
                {
                    this.InvalidMessage += $"The parameter's modifier: '{this.Modifier.GetCode()}' is not supported by this server for this search parameter type '{this.SearchParamTypeId.GetCode()}', the whole parameter was : '{this.RawValue}', ";
                    this.IsValid         = false;
                }
            }
        }
Exemplo n.º 6
0
 private bool GetBoolPropertyValueOrDefault(string Parameter, bool Default)
 {
     if (GlobalPropertiesDictionary.ContainsKey(Parameter))
     {
         return(StringSupport.StringToBoolean(GlobalPropertiesDictionary[Parameter]));
     }
     else
     {
         return(Default);
     }
 }
        static QueueClient InitializeReceiver()
        {
            var mSender   = new MessageSender(AccountDetails.ConnectionString, AccountDetails.ResponseQueueName);
            var mReciever = new QueueClient(AccountDetails.ConnectionString, AccountDetails.RequestQueueName, ReceiveMode.PeekLock);

            mReciever.RegisterSessionHandler(
                async(session, message, cancellationToken) =>
            {
                var stopwatch = new Stopwatch();
                stopwatch.Start();
                var sessionId = message.ReplyToSessionId;
                var body      = message.Body;

                var msg = StringSupport.GetString(body);

                string echoText = "Echo: " + msg;

                var outMsg = new Message
                {
                    Body      = StringSupport.GetBytes(echoText),
                    SessionId = sessionId
                };
                await mSender.SendAsync(outMsg);
                stopwatch.Stop();

                await session.CompleteAsync(message.SystemProperties.LockToken);
                await session.CloseAsync();


                lock (Console.Out)
                {
                    Console.ForegroundColor = ConsoleColor.Cyan;
                    Console.WriteLine("----");
                    Console.WriteLine("Message received");

                    Console.WriteLine("SessionId  = {0}", message.SessionId);
                    Console.WriteLine("MessageId  = {0}", message.MessageId);
                    Console.WriteLine("SequenceId = {0}", message.SessionId);
                    Console.WriteLine("Message    = {0}", msg);

                    Console.ResetColor();
                }
                Console.WriteLine("Time: {0} ms.", stopwatch.ElapsedMilliseconds);
                Console.WriteLine();
            },
                new SessionHandlerOptions(LogMessageHandlerException)
            {
                MessageWaitTimeout    = TimeSpan.FromSeconds(5),
                MaxConcurrentSessions = 1,
                AutoComplete          = false
            });
            return(mReciever);
        }
Exemplo n.º 8
0
        private static bool AppSettingAsBoolOrDefault(this string Key, bool Default)
        {
            string KeyValue = Key.AppSetting();

            if (StringSupport.StringIsBoolean(KeyValue))
            {
                return(StringSupport.StringToBoolean(KeyValue));
            }
            else
            {
                return(Default);
            }
        }
        /// <summary>
        /// Gets the ServiceBaseUrl Instance if found or creates a new instance if not found
        /// </summary>
        /// <param name="UrlString"></param>
        /// <returns></returns>
        public IDtoRootUrlStore GetAndOrAddService_RootUrlStore(string ServiceRootUrl)
        {
            IDtoRootUrlStore Pyro_RootUrlStore = this.GetPyro_RootUrlStore(ServiceRootUrl);

            if (Pyro_RootUrlStore == null)
            {
                var Pyro_RootUrlStoreDb = new _ServiceBaseUrl();
                Pyro_RootUrlStoreDb.IsServersPrimaryUrlRoot = false;
                Pyro_RootUrlStoreDb.Url = StringSupport.ToLowerFast(ServiceRootUrl.StripHttp());
                Pyro_RootUrlStoreDb     = IPyroDbContext.Set <_ServiceBaseUrl>().Add(Pyro_RootUrlStoreDb);
                this.Save();
                return(Pyro_RootUrlStoreDb);
            }
            else
            {
                return(Pyro_RootUrlStore);
            }
        }
Exemplo n.º 10
0
 public override bool TryParseValue(string Values)
 {
     this.ValueList = new List <SearchParameterStringValue>();
     foreach (string Value in Values.Split(OrDelimiter))
     {
         var DtoSearchParameterStringValue = new SearchParameterStringValue();
         if (this.Modifier.HasValue && this.Modifier == Hl7.Fhir.Model.SearchParameter.SearchModifierCode.Missing)
         {
             bool?IsMissing = DtoSearchParameterStringValue.ParseModifierEqualToMissing(Value);
             if (IsMissing.HasValue)
             {
                 DtoSearchParameterStringValue.IsMissing = IsMissing.Value;
                 this.ValueList.Add(DtoSearchParameterStringValue);
             }
             else
             {
                 this.InvalidMessage = $"Found the {Hl7.Fhir.Model.SearchParameter.SearchModifierCode.Missing.GetPyroLiteral()} Modifier yet is value was expected to be true or false yet found '{Value}'. ";
                 return(false);
             }
         }
         else
         {
             DtoSearchParameterStringValue.Value = StringSupport.ToLowerTrimRemoveDiacriticsTruncate(Value, Database.StaticDatabaseInfo.BaseDatabaseFieldLength.StringMaxLength);
             this.ValueList.Add(DtoSearchParameterStringValue);
         }
     }
     if (this.ValueList.Count() > 1)
     {
         this.HasLogicalOrProperties = true;
     }
     if (this.ValueList.Count > 0)
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
Exemplo n.º 11
0
        public override void ParseValue(string Values)
        {
            this.IsValid = true;
            this.ValueList.Clear();
            foreach (string Value in Values.Split(OrDelimiter))
            {
                if (this.Modifier.HasValue && this.Modifier == SearchModifierCode.Missing)
                {
                    bool?IsMissing = SearchQueryStringValue.ParseModifierEqualToMissing(Value);
                    if (IsMissing.HasValue)
                    {
                        this.ValueList.Add(new SearchQueryStringValue(IsMissing.Value, null));
                    }
                    else
                    {
                        this.InvalidMessage = $"Found the {SearchModifierCode.Missing.GetCode()} Modifier yet the value was expected to be true or false yet found '{Value}'. ";
                        this.IsValid        = false;
                        break;
                    }
                }
                else
                {
                    this.ValueList.Add(new SearchQueryStringValue(false, StringSupport.ToLowerTrimRemoveDiacriticsTruncate(Value, DatabaseMetaData.FieldLength.StringMaxLength)));
                }
            }

            if (ValueList.Count > 1)
            {
                this.HasLogicalOrProperties = true;
            }

            if (this.ValueList.Count == 0)
            {
                this.InvalidMessage = $"Unable to parse any values into a {this.GetType().Name} from the string: {Values}.";
                this.IsValid        = false;
            }
        }
Exemplo n.º 12
0
        public async Task <IServiceBaseUrl> GetPrimaryAsync(Bug.Common.Enums.FhirVersion fhirVersion)
        {
            byte[]? data = await IDistributedCache.GetAsync(GetPrimaryKey(fhirVersion));

            if (data is object)
            {
                return(JsonSerializer.Deserialize <ServiceBaseUrl>(data));
            }
            else
            {
                IServiceBaseUrl?ServiceBaseUrl = await IServiceBaseUrlRepository.GetPrimary(fhirVersion);

                if (ServiceBaseUrl is object)
                {
                    await this.SetPrimaryAsync(ServiceBaseUrl);

                    return(ServiceBaseUrl);
                }
                else
                {
                    ServiceBaseUrl = await IServiceBaseUrlRepository.AddAsync(fhirVersion, StringSupport.StripHttp(IServiceBaseUrlConfig.Url(fhirVersion).OriginalString), true);

                    await this.SetPrimaryAsync(ServiceBaseUrl);

                    return(ServiceBaseUrl);
                }
            }
        }
Exemplo n.º 13
0
 private _ServiceBaseUrl GetPyro_RootUrlStore(string ServiceRootUrl)
 {
     ServiceRootUrl = StringSupport.ToLowerFast(ServiceRootUrl.StripHttp());
     return(IPyroDbContext.ServiceBaseUrl.SingleOrDefault(x => x.Url == ServiceRootUrl));
 }
Exemplo n.º 14
0
        public void TestQueryTypesPositive(Common.Enums.FhirVersion fhirVersion, Common.Enums.ResourceType ResourceContext, Common.Enums.SearchParamType SearchParamType, string searchParameterName, string queryValue)
        {
            //Prepare
            Setup();
            List <SearchParameter> SearchParameterListForResource = ISearchParameterCacheMock !.Object.GetForIndexingAsync(fhirVersion, ResourceContext).Result;
            SearchParameter        SearchParameter = SearchParameterListForResource.SingleOrDefault(x => x.Name == searchParameterName);

            var Parameter = new KeyValuePair <string, StringValues>(searchParameterName, new StringValues(queryValue));

            //Act
            IList <ISearchQueryBase> ISearchQueryBaseList = SearchQueryFactory !.Create(ResourceContext, SearchParameter, Parameter, false).Result;

            //Assert
            Assert.Equal(1, ISearchQueryBaseList.Count);
            ISearchQueryBase SearchQueryResult = ISearchQueryBaseList[0];

            Assert.Null(SearchQueryResult.ChainedSearchParameter);
            if (SearchParamType == Common.Enums.SearchParamType.Composite)
            {
                Assert.NotNull(SearchQueryResult.ComponentList);
                //We are only assuming all Composite have only two components here, which is not always true
                Assert.Equal(2, SearchQueryResult.ComponentList.Count);
            }
            else
            {
                Assert.Equal(0, SearchQueryResult.ComponentList.Count);
            }

            Assert.Equal(fhirVersion, SearchQueryResult.FhirVersionId);
            Assert.Equal(queryValue.Contains(','), SearchQueryResult.HasLogicalOrProperties);
            Assert.Equal(string.Empty, SearchQueryResult.InvalidMessage);
            Assert.True(SearchQueryResult.IsValid);
            Assert.Null(SearchQueryResult.Modifier);
            Assert.Equal(searchParameterName, SearchQueryResult.Name);
            Assert.Equal($"{searchParameterName}={queryValue}", SearchQueryResult.RawValue);
            Assert.Equal(ResourceContext, SearchQueryResult.ResourceContext);
            Assert.True(SearchQueryResult.ResourceTypeList.Count > 0);
            Assert.Contains(SearchQueryResult.ResourceTypeList.ToArray(), x => x.ResourceTypeId == ResourceContext);
            Assert.Equal(SearchParamType, SearchQueryResult.SearchParamTypeId);
            if (SearchParamType == Common.Enums.SearchParamType.Reference)
            {
                Assert.True(SearchQueryResult.TargetResourceTypeList.Count > 0);
            }
            else
            {
                Assert.True(SearchQueryResult.TargetResourceTypeList.Count == 0);
            }
            Assert.False(SearchQueryResult.TypeModifierResource.HasValue);


            if (SearchQueryResult is SearchQueryComposite SearchQueryComposite)
            {
                Assert.Equal(2, SearchQueryResult.ComponentList.Count);
                Assert.True(SearchQueryComposite.ValueList.Count == 1);
                Assert.True(SearchQueryComposite.ValueList[0].SearchQueryBaseList.Count == 2);
                if (SearchQueryComposite.ValueList[0].SearchQueryBaseList[0] is SearchQueryToken SearchQueryToken)
                {
                    Assert.True(SearchQueryToken.ValueList.Count == 1);
                    Assert.Equal(queryValue.Split('$')[0].Split('|')[0], SearchQueryToken.ValueList[0].System);
                    Assert.Equal(queryValue.Split('$')[0].Split('|')[1], SearchQueryToken.ValueList[0].Code);
                }
            }
            else if (SearchQueryResult is SearchQueryString SearchQueryString)
            {
                if (queryValue.Contains(','))
                {
                    Assert.Equal(StringSupport.ToLowerTrimRemoveDiacriticsTruncate(queryValue.Split(',')[0], DatabaseMetaData.FieldLength.StringMaxLength), SearchQueryString.ValueList[0].Value);
                    Assert.Equal(StringSupport.ToLowerTrimRemoveDiacriticsTruncate(queryValue.Split(',')[1], DatabaseMetaData.FieldLength.StringMaxLength), SearchQueryString.ValueList[1].Value);
                }
                else
                {
                    Assert.Equal(StringSupport.ToLowerTrimRemoveDiacriticsTruncate(queryValue, DatabaseMetaData.FieldLength.StringMaxLength), SearchQueryString.ValueList[0].Value);
                }
            }
            else if (SearchQueryResult is SearchQueryReference SearchQueryReference)
            {
                Assert.NotNull(SearchQueryReference.ValueList[0].FhirUri);
                if (queryValue.StartsWith(TestData.BaseUrlServer))
                {
                    Assert.Equal(Common.Enums.ResourceType.Patient.GetCode(), SearchQueryReference.ValueList[0].FhirUri !.ResourseName);
                    Assert.Equal("11", SearchQueryReference.ValueList[0].FhirUri !.ResourceId);
                    Assert.True(SearchQueryReference.ValueList[0].FhirUri !.IsRelativeToServer);
                }
                else if (queryValue.StartsWith(TestData.BaseUrlRemote))
                {
                    Assert.Equal(Common.Enums.ResourceType.Patient.GetCode(), SearchQueryReference.ValueList[0].FhirUri !.ResourseName);
                    Assert.Equal("11", SearchQueryReference.ValueList[0].FhirUri !.ResourceId);
                    Assert.False(SearchQueryReference.ValueList[0].FhirUri !.IsRelativeToServer);
                }
                else if (queryValue.Contains('/'))
                {
                    Assert.Equal(queryValue.Split('/')[0], SearchQueryReference.ValueList[0].FhirUri !.ResourseName);
                    Assert.Equal(queryValue.Split('/')[1], SearchQueryReference.ValueList[0].FhirUri !.ResourceId);
                }
                else
                {
                    Assert.Equal(Common.Enums.ResourceType.Encounter.GetCode(), SearchQueryReference.ValueList[0].FhirUri !.ResourseName);
                    Assert.Equal(queryValue, SearchQueryReference.ValueList[0].FhirUri !.ResourceId);
                }
            }
            else if (SearchQueryResult is SearchQueryToken SearchQueryToken)
            {
                if (queryValue.StartsWith("code"))
                {
                    Assert.Null(SearchQueryToken.ValueList[0].System);
                    Assert.Equal(queryValue, SearchQueryToken.ValueList[0].Code);
                }
                else if (queryValue.EndsWith("|"))
                {
                    Assert.Null(SearchQueryToken.ValueList[0].Code);
                    Assert.Equal(queryValue.TrimEnd('|'), SearchQueryToken.ValueList[0].System);
                }
                else
                {
                    Assert.Equal(queryValue.Split('|')[0], SearchQueryToken.ValueList[0].System);
                    Assert.Equal(queryValue.Split('|')[1], SearchQueryToken.ValueList[0].Code);
                }
            }
            else if (SearchQueryResult is SearchQueryQuantity SearchQueryQuantity)
            {
                Assert.Equal(queryValue.Split('|')[1], SearchQueryQuantity.ValueList[0].System);
                Assert.Equal(queryValue.Split('|')[2], SearchQueryQuantity.ValueList[0].Code);
                if (queryValue.Split('|')[0].Contains("e+10") && queryValue.Split('|')[0].StartsWith('-'))
                {
                    Assert.Equal(-54000000000m, SearchQueryQuantity.ValueList[0].Value);
                    Assert.Equal(0, SearchQueryQuantity.ValueList[0].Scale);
                    Assert.Equal(11, SearchQueryQuantity.ValueList[0].Precision);
                }
                else if (queryValue.Split('|')[0].Contains("e-3"))
                {
                    Assert.Equal(0.00540m, SearchQueryQuantity.ValueList[0].Value);
                    Assert.Equal(5, SearchQueryQuantity.ValueList[0].Scale);
                    Assert.Equal(5, SearchQueryQuantity.ValueList[0].Precision);
                }
                else if (queryValue.Split('|')[0].Contains("e+10"))
                {
                    Assert.Equal(54000000000m, SearchQueryQuantity.ValueList[0].Value);
                    Assert.Equal(0, SearchQueryQuantity.ValueList[0].Scale);
                    Assert.Equal(11, SearchQueryQuantity.ValueList[0].Precision);
                }
                else
                {
                    Assert.Equal(Decimal.Parse(queryValue.Split('|')[0]), SearchQueryQuantity.ValueList[0].Value);
                    Assert.Equal(1, SearchQueryQuantity.ValueList[0].Scale);
                    Assert.Equal(2, SearchQueryQuantity.ValueList[0].Precision);
                }
            }
            else if (SearchQueryResult is SearchQueryNumber SearchQueryNumber)
            {
                if (queryValue.StartsWith("gt"))
                {
                    Assert.Equal(100, SearchQueryNumber.ValueList[0].Value);
                    Assert.Equal(0, SearchQueryNumber.ValueList[0].Scale);
                    Assert.Equal(3, SearchQueryNumber.ValueList[0].Precision);
                    Assert.Equal(SearchComparator.Gt, SearchQueryNumber.ValueList[0].Prefix);
                }
                else if (queryValue.StartsWith("lt"))
                {
                    Assert.Equal(100, SearchQueryNumber.ValueList[0].Value);
                    Assert.Equal(0, SearchQueryNumber.ValueList[0].Scale);
                    Assert.Equal(3, SearchQueryNumber.ValueList[0].Precision);
                    Assert.Equal(SearchComparator.Lt, SearchQueryNumber.ValueList[0].Prefix);
                }
                else if (queryValue == "100")
                {
                    Assert.Equal(100, SearchQueryNumber.ValueList[0].Value);
                    Assert.Equal(0, SearchQueryNumber.ValueList[0].Scale);
                    Assert.Equal(3, SearchQueryNumber.ValueList[0].Precision);
                    Assert.Null(SearchQueryNumber.ValueList[0].Prefix);
                }
                else if (queryValue == "100.00")
                {
                    Assert.Equal(100.00m, SearchQueryNumber.ValueList[0].Value);
                    Assert.Equal(2, SearchQueryNumber.ValueList[0].Scale);
                    Assert.Equal(5, SearchQueryNumber.ValueList[0].Precision);
                    Assert.Null(SearchQueryNumber.ValueList[0].Prefix);
                }
            }
            else if (SearchQueryResult is SearchQueryDateTime SearchQueryDateTime)
            {
                if (queryValue.StartsWith("gt"))
                {
                    var testDate = new DateTimeOffset(new DateTime(2020, 04, 07), TimeSpan.FromHours(10));
                    Assert.Equal(testDate.ToUniversalTime().DateTime, SearchQueryDateTime.ValueList[0].Value);
                    Assert.Equal(DateTimePrecision.Day, SearchQueryDateTime.ValueList[0].Precision);
                    Assert.Equal(SearchComparator.Gt, SearchQueryDateTime.ValueList[0].Prefix);
                }
                else if (queryValue.Length == 16)
                {
                    var testDate = new DateTimeOffset(new DateTime(2020, 04, 07, 10, 00, 00), TimeSpan.FromHours(10));
                    Assert.Equal(testDate.ToUniversalTime().DateTime, SearchQueryDateTime.ValueList[0].Value);
                    Assert.Equal(DateTimePrecision.HourMin, SearchQueryDateTime.ValueList[0].Precision);
                }
                else if (queryValue.Length == 4)
                {
                    var testDate = new DateTimeOffset(new DateTime(2020, 01, 01), TimeSpan.FromHours(10));
                    Assert.Equal(testDate.ToUniversalTime().DateTime, SearchQueryDateTime.ValueList[0].Value);
                    Assert.Equal(DateTimePrecision.Year, SearchQueryDateTime.ValueList[0].Precision);
                }
                else if (queryValue.Length == 7)
                {
                    var testDate = new DateTimeOffset(new DateTime(2020, 04, 01), TimeSpan.FromHours(10));
                    Assert.Equal(testDate.ToUniversalTime().DateTime, SearchQueryDateTime.ValueList[0].Value);
                    Assert.Equal(DateTimePrecision.Month, SearchQueryDateTime.ValueList[0].Precision);
                }
                else if (queryValue.Length == 10)
                {
                    var testDate = new DateTimeOffset(new DateTime(2020, 04, 07), TimeSpan.FromHours(10));
                    Assert.Equal(testDate.ToUniversalTime().DateTime, SearchQueryDateTime.ValueList[0].Value);
                    Assert.Equal(DateTimePrecision.Day, SearchQueryDateTime.ValueList[0].Precision);
                }
                else if (queryValue.Length == 19)
                {
                    var testDate = new DateTimeOffset(new DateTime(2020, 04, 07, 10, 00, 10), TimeSpan.FromHours(10));
                    Assert.Equal(testDate.ToUniversalTime().DateTime, SearchQueryDateTime.ValueList[0].Value);
                    Assert.Equal(DateTimePrecision.Sec, SearchQueryDateTime.ValueList[0].Precision);
                }
                else if (queryValue.Length == 25)
                {
                    var testDate = new DateTimeOffset(new DateTime(2020, 04, 07, 10, 00, 10), TimeSpan.FromHours(5));
                    Assert.Equal(testDate.ToUniversalTime().DateTime, SearchQueryDateTime.ValueList[0].Value);
                    Assert.Equal(DateTimePrecision.Sec, SearchQueryDateTime.ValueList[0].Precision);
                }
            }
            else if (SearchQueryResult is SearchQueryUri SearchQueryUri)
            {
                Assert.Equal(new Uri(queryValue), SearchQueryUri.ValueList[0].Value);
            }
            else
            {
                Assert.Null(SearchQueryResult.ComponentList);
            }
        }