Exemple #1
0
        public static Key ExtractKey(Uri uri)
        {
            var identity = new ResourceIdentity(uri);

            string _base = (identity.HasBaseUri) ? identity.BaseUri.ToString() : null;
            Key key = new Key(_base, identity.ResourceType, identity.Id, identity.VersionId);
            return key;
        }
Exemple #2
0
        public void TestIndexResourcePatientComplete()
        {
            var patientResource = FhirParser.ParseResourceFromJson(examplePatientJson);

            IKey patientKey = new Key("http://localhost/", "Patient", "001", null);

            IndexValue result = sutFull.IndexResource(patientResource, patientKey);

            Assert.IsNotNull(result);
        }
Exemple #3
0
        public void TestIndexResourceSimple()
        {
            var patient = new Patient();
            patient.Name.Add(new HumanName().WithGiven("Adriaan").AndFamily("Bestevaer"));

            IKey patientKey = new Key("http://localhost/", "Patient", "001", "v02");

            IndexValue result = sutLimited.IndexResource(patient, patientKey);

            Assert.AreEqual("root", result.Name);
            Assert.AreEqual(5, result.Values.Count, "Expected 1 result for searchparameter 'name' and 4 for meta info");
            Assert.IsInstanceOfType(result.Values[0], typeof(IndexValue));
            var first = (IndexValue)result.Values[0];
            Assert.AreEqual("name", first.Name);
            Assert.AreEqual(2, first.Values.Count);
            Assert.IsInstanceOfType(first.Values[0], typeof(StringValue));
            Assert.IsInstanceOfType(first.Values[1], typeof(StringValue));
        }
Exemple #4
0
        public void TestIndexResourceAppointmentComplete()
        {
            var appResource = FhirParser.ParseResourceFromJson(exampleAppointmentJson);

            IKey appKey = new Key("http://localhost/", "Appointment", "2docs", null);

            IndexValue result = sutFull.IndexResource(appResource, appKey);

            Assert.IsNotNull(result);
        }
Exemple #5
0
        public void TestIndexWithPath_x_()
        {
            Condition cd = new Condition();
            cd.Onset = new FhirDateTime(2015, 6, 15);

            IKey cdKey = new Key("http://localhost/", "Condition", "test", null);

            IndexValue result = sutFull.IndexResource(cd, cdKey);

            Assert.IsNotNull(result);
            Assert.IsNotNull(result.Values.Where(iv => (iv as IndexValue).Name == "onset"));
        }
Exemple #6
0
        public void TestIndexResourceObservation()
        {
            var obsResource = FhirParser.ParseResourceFromJson(exampleObservationJson);

            IKey cpKey = new Key("http://localhost/", "Observation", "blood-pressure", null);

            IndexValue result = sutFull.IndexResource(obsResource, cpKey);

            Assert.IsNotNull(result);
        }
Exemple #7
0
        public void TestIndexResourceCareplanWithContainedGoal()
        {
            var cpResource = FhirParser.ParseResourceFromJson(careplanWithContainedGoal);

            IKey cpKey = new Key("http://localhost/", "Careplan", "f002", null);

            IndexValue result = sutFull.IndexResource(cpResource, cpKey);

            Assert.IsNotNull(result);
        }
Exemple #8
0
 public static FhirResponse WithResource(HttpStatusCode code, Key key, Resource resource)
 {
     return new FhirResponse(code, key, resource);
 }
Exemple #9
0
        public static IKey GetKey(BsonDocument document)
        {
            Key key = new Key();
            key.TypeName = (string)document[Field.TYPENAME];
            key.ResourceId = (string)document[Field.RESOURCEID];
            key.VersionId = (string)document[Field.VERSIONID];

            return key;
        }
Exemple #10
0
 public static Key ExtractKey(this Resource resource)
 {
     string _base = (resource.ResourceBase != null) ? resource.ResourceBase.ToString() : null;
     Key key = new Key(_base, resource.TypeName, resource.Id, resource.VersionId);
     return key;
 }
Exemple #11
0
 public static Key Clone(this IKey self)
 {
     Key key = new Key(self.Base, self.TypeName, self.ResourceId, self.VersionId);
     return key;
 }