Esempio n. 1
0
        public async Task CheckSearchParameter(
            string resourceType,
            IEnumerable <SearchParameterInfo> parameters)
        {
            foreach (var parameterInfo in parameters)
            {
                var fhirPath        = parameterInfo.Expression;
                var parameterCode   = parameterInfo.Code;
                var searchParamType = parameterInfo.Type;

                _outputHelper.WriteLine("** Evaluating: " + fhirPath);

                var converters =
                    await GetConvertsForSearchParameters(resourceType, parameterInfo);

                Assert.True(
                    converters.Any(x => x.hasConverter),
                    $"{resourceType}.{parameterCode} ({converters.First().result.FhirNodeType}=>{searchParamType}) was not able to be mapped.");

                string listedTypes = string.Join(",", converters.Select(x => x.result.FhirNodeType));
                _outputHelper.WriteLine($"Info: {parameterCode} ({searchParamType}) found {listedTypes} types ({converters.Count}).");

                foreach (var result in converters.Where(x => x.hasConverter || !parameterInfo.IsPartiallySupported))
                {
                    var found = (await SearchParameterFixtureData.GetFhirNodeToSearchValueTypeConverterManagerAsync()).TryGetConverter(result.result.FhirNodeType, SearchIndexer.GetSearchValueTypeForSearchParamType(result.result.SearchParamType), out var converter);

                    var    converterText     = found ? converter.GetType().Name : "None";
                    string searchTermMapping = $"Search term '{parameterCode}' ({result.result.SearchParamType}) mapped to '{result.result.FhirNodeType}', converter: {converterText}";
                    _outputHelper.WriteLine(searchTermMapping);

                    Assert.True(found, searchTermMapping);
                }
            }
        }
Esempio n. 2
0
        public void CheckSearchParameter(
            string resourceType,
            IEnumerable <SearchParameterInfo> parameters)
        {
            SearchParameterToTypeResolver.Log = s => _outputHelper.WriteLine(s);

            foreach (var parameterInfo in parameters)
            {
                var fhirPath        = parameterInfo.Expression;
                var parameterName   = parameterInfo.Name;
                var searchParamType = parameterInfo.Type;

                _outputHelper.WriteLine("** Evaluating: " + fhirPath);

                var converters =
                    GetConvertsForSearchParameters(resourceType, parameterInfo);

                Assert.True(
                    converters.Any(x => x.hasConverter),
                    $"{parameterName} ({resourceType}) was not able to be mapped.");

                string listedTypes = string.Join(",", converters.Select(x => x.result.ClassMapping.NativeType.Name));
                _outputHelper.WriteLine($"Info: {parameterName} ({searchParamType}) found {listedTypes} types ({converters.Count}).");

                foreach (var result in converters.Where(x => x.hasConverter || !parameterInfo.IsPartiallySupported))
                {
                    var found = SearchParameterFixtureData.Manager.TryGetConverter(result.result.ClassMapping.NativeType, SearchIndexer.GetSearchValueTypeForSearchParamType(result.result.SearchParamType), out var converter);

                    var    converterText     = found ? converter.GetType().Name : "None";
                    string searchTermMapping = $"Search term '{parameterName}' ({result.result.SearchParamType}) mapped to '{result.result.ClassMapping.NativeType.Name}', converter: {converterText}";
                    _outputHelper.WriteLine(searchTermMapping);

                    Assert.True(found, searchTermMapping);
                }
            }
        }