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); }
public FhirService(ILocalhost localhost, IFhirStore fhirStore, ISnapshotStore snapshotStore, IGenerator keyGenerator, IFhirIndex fhirIndex, IServiceListener serviceListener, IFhirResponseFactory responseFactory, IndexService indexService) { this.localhost = localhost; this.fhirStore = fhirStore; this.snapshotstore = snapshotStore; this.keyGenerator = keyGenerator; this.fhirIndex = fhirIndex; this.serviceListener = serviceListener; this.responseFactory = responseFactory; _indexService = indexService; transfer = new Transfer(this.keyGenerator, localhost); pager = new Pager(this.fhirStore, snapshotstore, localhost, transfer, ModelInfo.SearchParameters); //TODO: Use FhirModel instead of ModelInfo for the searchparameters. }