public void ExpansionOfComposeInclude() { var testVs = _resolver.ResolveByCanonicalUri("http://hl7.org/fhir/ValueSet/marital-status").DeepCopy() as ValueSet; Assert.False(testVs.HasExpansion); var expander = new ValueSetExpander(new ValueSetExpanderSettings { ValueSetSource = _resolver }); expander.Expand(testVs); Assert.Equal(11, testVs.ExpansionSize()); }
public void ExpansionOfComposeImport() { var testVs = _resolver.ResolveByCanonicalUri("http://hl7.org/fhir/ValueSet/referencerange-meaning").DeepCopy() as ValueSet; Assert.False(testVs.HasExpansion); var expander = new ValueSetExpander(new ValueSetExpanderSettings { ValueSetSource = _resolver }); Assert.Throws <ValueSetExpansionTooBigException>(() => expander.Expand(testVs)); expander.Settings.MaxExpansionSize = 1000; expander.Expand(testVs); Assert.Equal(937, testVs.ExpansionSize()); }
public void ExpansionOfDefine() { var issueTypeVs = _resolver.ResolveByCanonicalUri("http://hl7.org/fhir/ValueSet/issue-type").DeepCopy() as ValueSet; Assert.False(issueTypeVs.HasExpansion); // Wipe the version so we don't have to update our tests all the time issueTypeVs.CodeSystem.Version = null; var expander = new ValueSetExpander(); expander.Expand(issueTypeVs); Assert.True(issueTypeVs.HasExpansion); var id = issueTypeVs.Expansion.Identifier; Assert.NotNull(id); Assert.DoesNotContain(issueTypeVs.Expansion.Parameter, c => c.Name == "version"); Assert.True(issueTypeVs.CodeInExpansion("security", "http://hl7.org/fhir/issue-type")); Assert.True(issueTypeVs.CodeInExpansion("expired", "http://hl7.org/fhir/issue-type")); Assert.Equal(29, issueTypeVs.ExpansionSize()); Assert.Equal(issueTypeVs.ExpansionSize(), issueTypeVs.Expansion.Total); var trans = issueTypeVs.FindInExpansion("transient", "http://hl7.org/fhir/issue-type"); Assert.NotNull(trans); Assert.NotNull(trans.FindCode("exception")); // Now, make this a versioned system issueTypeVs.CodeSystem.Version = "3.14"; expander.Expand(issueTypeVs); Assert.NotEqual(id, issueTypeVs.Expansion.Identifier); Assert.Equal(29, issueTypeVs.ExpansionSize()); var versionParam = issueTypeVs.Expansion.Parameter.Single(c => c.Name == "version"); Assert.Equal("http://hl7.org/fhir/ValueSet/issue-type?version=3.14", ((FhirUri)versionParam.Value).Value); }