Exemplo n.º 1
0
        public void RetrieveArtifactMulti()
        {
            var resolver = new MultiResolver(source, new WebResolver());

            var vs = resolver.ResolveByCanonicalUri("http://hl7.org/fhir/ValueSet/v2-0292");
            Assert.IsNotNull(vs);
            Assert.IsTrue(vs is ValueSet);

            var artifact = resolver.ResolveByUri("http://fhir2.healthintersections.com.au/open/StructureDefinition/flag");

            Assert.IsNotNull(artifact);
            Assert.IsTrue(artifact is StructureDefinition);
            Assert.AreEqual("Flag", ((StructureDefinition)artifact).Name);
        }
Exemplo n.º 2
0
        public void RetrieveArtifactMulti()
        {
            var resolver = new MultiResolver(source, new WebResolver());

            var vs = resolver.ResolveByCanonicalUri("http://hl7.org/fhir/ValueSet/v2-0292");

            Assert.IsNotNull(vs);
            Assert.IsTrue(vs is ValueSet);

            var artifact = resolver.ResolveByUri("http://test.fhir.org/r2/StructureDefinition/Patient");

            Assert.IsNotNull(artifact);
            Assert.IsTrue(artifact is StructureDefinition);
            Assert.AreEqual("Patient", ((StructureDefinition)artifact).Name);
        }
Exemplo n.º 3
0
        public async Task TestAsyncSyncMultiResolver()
        {
            var(sr, ar, sar) = (new SyncResolver(), new AsyncResolver(), new SyncAsyncResolver());
            var multi = new MultiResolver(sr, ar, sar);

            // calling *any* kind of resolve will involve all child resolvers, since they all return null.
            _ = await multi.ResolveByUriAsync("");

#pragma warning disable CS0618 // Type or member is obsolete
            _ = multi.ResolveByCanonicalUri("");
#pragma warning restore CS0618 // Type or member is obsolete

            Assert.AreEqual(1, sr.ByUri);
            Assert.AreEqual(1, sr.ByCanonical);

            Assert.AreEqual(1, ar.ByUriAsync);
            Assert.AreEqual(1, ar.ByCanonicalAsync);

            Assert.AreEqual(0, sar.ByUri);       // multi will always prefer the async
            Assert.AreEqual(0, sar.ByCanonical); // multi will always prefer the async
            Assert.AreEqual(1, sar.ByUriAsync);
            Assert.AreEqual(1, sar.ByCanonicalAsync);
        }