diff --git a/src/Hl7.Fhir.Conformance/Specification/Snapshot/SnapshotGenerator.cs b/src/Hl7.Fhir.Conformance/Specification/Snapshot/SnapshotGenerator.cs index 185d6043fd..e67d4cd33a 100644 --- a/src/Hl7.Fhir.Conformance/Specification/Snapshot/SnapshotGenerator.cs +++ b/src/Hl7.Fhir.Conformance/Specification/Snapshot/SnapshotGenerator.cs @@ -143,15 +143,14 @@ private static IAsyncResourceResolver verifySource(IAsyncResourceResolver resolv /// A instance. public async T.Task UpdateAsync(StructureDefinition structure) { - var result = await GenerateAsync(structure).ConfigureAwait(false); - - if (result == null && structure.Snapshot?.Element != null) return; - - structure.Snapshot = new StructureDefinition.SnapshotComponent { Element = result }; - structure.Snapshot.SetCreatedBySnapshotGenerator(); + structure.Snapshot = new StructureDefinition.SnapshotComponent() + { + Element = await GenerateAsync(structure).ConfigureAwait(false) + }; + structure.Snapshot.SetCreatedBySnapshotGenerator(); - // [WMR 20170209] TODO: also merge global StructureDefinition.Mapping components - // structure.Mappings = ElementDefnMerger.Merge(...) + // [WMR 20170209] TODO: also merge global StructureDefinition.Mapping components + // structure.Mappings = ElementDefnMerger.Merge(...) } /// diff --git a/src/Hl7.Fhir.Specification.Shared.Tests/Snapshot/SnapshotGeneratorTest.cs b/src/Hl7.Fhir.Specification.Shared.Tests/Snapshot/SnapshotGeneratorTest.cs index 30983d50df..fdcad73618 100644 --- a/src/Hl7.Fhir.Specification.Shared.Tests/Snapshot/SnapshotGeneratorTest.cs +++ b/src/Hl7.Fhir.Specification.Shared.Tests/Snapshot/SnapshotGeneratorTest.cs @@ -3194,42 +3194,6 @@ public async T.Task FindComplexTestExtensions() } }; - private static StructureDefinition LogicalModelWithoutDiff => new() - { - Name = "MyLogicalModel", - Url = "http://example.org/fhir/StructureDefinition/MyLogicalModel", - Type = "http://foo.org/bar", - Derivation = StructureDefinition.TypeDerivationRule.Constraint, - BaseDefinition = "http://hl7.org/fhir/StructureDefinition/Base", - Kind = StructureDefinition.StructureDefinitionKind.Logical, - Snapshot = new() - { - Element = new() - { - new() - { - ElementId = "logicalmodel", - Path = "logicalmodel", - Short = "root" - - }, - new() - { - ElementId = "logicalmodel.Identifier", - Path = "logicalmodel.Identifier", - Short = "Identifier", - Min = 1, - Max = "*", - Type = new() - { - new() {Code = "Identifier"} - } - }, - } - } - - }; - [Conditional("DEBUG")] private void dumpElements(IEnumerable elements, string header = null) => dumpElements(elements.ToList(), header); @@ -3332,23 +3296,6 @@ public async T.Task TestMissingDifferential() expanded.Snapshot.Element.Dump(); } - [TestMethod] - public async T.Task TestMissingDifferentialLogicalModel() - { - // Create a profile without a differential - var profile = LogicalModelWithoutDiff; - - var resolver = new InMemoryResourceResolver(profile); - var multiResolver = new MultiResolver(_testResolver, resolver); - _generator = new SnapshotGenerator(multiResolver, _settings); - - var (_, expanded) = await generateSnapshotAndCompare(profile); - Assert.IsNotNull(expanded); - Assert.IsTrue(expanded.HasSnapshot); - - expanded.Snapshot.Element.Dump(); - } - [TestMethod] public async T.Task TestUnresolvedBaseProfile() {