private static void generateSnapshotAndCompare(StructureDefinition original, ArtifactResolver source) { var generator = new SnapshotGenerator(source, markChanges: false); var expanded = (StructureDefinition)original.DeepCopy(); Assert.IsTrue(original.IsExactly(expanded)); generator.Generate(expanded); // Simulate bug in Grahame's expander if (original.Snapshot.Element.Count == expanded.Snapshot.Element.Count) { for (var ix = 0; ix < expanded.Snapshot.Element.Count; ix++) { if (original.Snapshot.Element[ix].Path == expanded.Snapshot.Element[ix].Path) { expanded.Snapshot.Element[ix].Min = original.Snapshot.Element[ix].Min; expanded.Snapshot.Element[ix].MustSupport = original.Snapshot.Element[ix].MustSupport; } } } var areEqual = original.IsExactly(expanded); if (!areEqual) { File.WriteAllText("c:\\temp\\snapshotgen-source.xml", FhirSerializer.SerializeResourceToXml(original)); File.WriteAllText("c:\\temp\\snapshotgen-dest.xml", FhirSerializer.SerializeResourceToXml(expanded)); } Assert.IsTrue(areEqual); }
private static void generateSnapshotAndCompare(StructureDefinition original, ArtifactResolver source) { var generator = new SnapshotGenerator(source, markChanges: false); var expanded = (StructureDefinition)original.DeepCopy(); Assert.IsTrue(original.IsExactly(expanded)); generator.Generate(expanded); var areEqual = original.IsExactly(expanded); if (!areEqual) { File.WriteAllText("c:\\temp\\snapshotgen-source.xml", FhirSerializer.SerializeResourceToXml(original)); File.WriteAllText("c:\\temp\\snapshotgen-dest.xml", FhirSerializer.SerializeResourceToXml(expanded)); } Assert.IsTrue(areEqual); }
private void generateSnapshotAndCompare(StructureDefinition original, ArtifactResolver source) { // var generator = new SnapshotGenerator(source, markChanges: false); var generator = new SnapshotGenerator(source, _settings); var expanded = (StructureDefinition)original.DeepCopy(); Assert.IsTrue(original.IsExactly(expanded)); generator.Generate(expanded); var areEqual = original.IsExactly(expanded); if (!areEqual) { var tempPath = Path.GetTempPath(); File.WriteAllText(Path.Combine(tempPath, "snapshotgen-source.xml"), FhirSerializer.SerializeResourceToXml(original)); File.WriteAllText(Path.Combine(tempPath, "snapshotgen-dest.xml"), FhirSerializer.SerializeResourceToXml(expanded)); } Assert.IsTrue(areEqual); }