Exemplo n.º 1
0
 public IndexService(IFhirModel fhirModel, FhirPropertyIndex propIndex, ResourceVisitor resourceVisitor, ElementIndexer elementIndexer, IIndexStore indexStore)
 {
     _fhirModel       = fhirModel;
     _propIndex       = propIndex;
     _resourceVisitor = resourceVisitor;
     _elementIndexer  = elementIndexer;
     _indexStore      = indexStore;
 }
Exemplo n.º 2
0
        public void TestGetIndex()
        {
            var index = new FhirPropertyIndex(_fhirModel, new List <Type> {
                typeof(Patient), typeof(Account)
            });

            Assert.IsNotNull(index);
        }
Exemplo n.º 3
0
 public void TestInitialize()
 {
     _fhirModel = new FhirModel();
     _index     = new FhirPropertyIndex(_fhirModel, new List <Type> {
         typeof(Patient), typeof(ClinicalImpression), typeof(HumanName), typeof(CodeableConcept), typeof(Coding)
     });
     _sut     = new ResourceVisitor(_index);
     _patient = new Patient();
     _patient.Name.Add(new HumanName().WithGiven("Sjors").AndFamily("Jansen"));
 }
Exemplo n.º 4
0
        public void TestTypedNameIsFound()
        {
            var index = new FhirPropertyIndex(_fhirModel, new List <Type> {
                typeof(ClinicalImpression), typeof(Period)
            });

            var pm = index.findPropertyInfo("ClinicalImpression", "effectivePeriod");

            Assert.IsNotNull(pm);
        }
Exemplo n.º 5
0
        public void TestTypedNameIsFound()
        {
            var index = new FhirPropertyIndex(_fhirModel, new List <Type> {
                typeof(ClinicalImpression), typeof(CodeableConcept)
            });

            var pm = index.findPropertyInfo("ClinicalImpression", "triggerCodeableConcept");

            Assert.IsNotNull(pm);
        }
Exemplo n.º 6
0
        public void TestNonExistingPropertyReturnsNull()
        {
            var index = new FhirPropertyIndex(_fhirModel, new List <Type> {
                typeof(Patient), typeof(Account)
            });

            var pm = index.findPropertyInfo("TypeNotPresent", "subject");

            Assert.IsNull(pm);

            pm = index.findPropertyInfo("Patient", "property_not_present");
            Assert.IsNull(pm);
        }
Exemplo n.º 7
0
        public void TestExistingPropertyIsFound()
        {
            var index = new FhirPropertyIndex(_fhirModel, new List <Type> {
                typeof(Patient), typeof(HumanName)
            });

            var pm = index.findPropertyInfo("Patient", "name");

            Assert.IsNotNull(pm);

            pm = index.findPropertyInfo("HumanName", "given");
            Assert.IsNotNull(pm);
        }
Exemplo n.º 8
0
        public void TestInitialize()
        {
            IFhirModel        _fhirModel;
            FhirPropertyIndex _propIndex;
            ResourceVisitor   _resourceVisitor;
            ElementIndexer    _elementIndexer;
            var _indexStoreMock = new Mock <IIndexStore>();

            var spPatientName = new SearchParamDefinition()
            {
                Resource = "Patient", Name = "name", Description = @"A portion of either family or given name of the patient", Type = SearchParamType.String, Path = new string[] { "Patient.name", }
            };
            var searchParameters = new List <SearchParamDefinition> {
                spPatientName
            };
            var resources = new Dictionary <Type, string> {
                { typeof(Patient), "Patient" }, { typeof(HumanName), "HumanName" }
            };
            var enums = new List <Type>();

            //CK: I use real objects: saves me a lot of mocking and provides for a bit of integration testing.
            _fhirModel = new FhirModel(resources, searchParameters, enums);
            _propIndex = new FhirPropertyIndex(_fhirModel, new List <Type> {
                typeof(Patient), typeof(HumanName)
            });
            _resourceVisitor = new ResourceVisitor(_propIndex);
            _elementIndexer  = new ElementIndexer(_fhirModel);

            //_indexStoreMock.Setup(ixs => ixs.Save(It.IsAny<IndexValue>))

            sutLimited = new IndexService(_fhirModel, _propIndex, _resourceVisitor, _elementIndexer, _indexStoreMock.Object);

            _fhirModel       = new FhirModel(); //For this test I want all available types and searchparameters.
            _propIndex       = new FhirPropertyIndex(_fhirModel);
            _resourceVisitor = new ResourceVisitor(_propIndex);
            _elementIndexer  = new ElementIndexer(_fhirModel);

            sutFull = new IndexService(_fhirModel, _propIndex, _resourceVisitor, _elementIndexer, _indexStoreMock.Object);
        }