public void ExportFHIRComposition() { MockObjectRepository tdb = new MockObjectRepository(); tdb.InitializeFHIRRepository(); ImplementationGuide ig = tdb.FindOrAddImplementationGuide(MockObjectRepository.DEFAULT_FHIR_DSTU1_IG_TYPE_NAME, "Test FHIR IG"); Template t = tdb.GenerateTemplate("FHIR_1.2.3.4", "Composition", "Test FHIR Composition", ig, "Composition", "Composition"); var tc1 = tdb.GenerateConstraint(t, null, null, "subject", "SHALL", "1..1"); var tc2 = tdb.GenerateConstraint(t, null, null, "author", "SHALL", "1..1"); List <Template> templates = new List <Template>(); templates.Add(t); string export = FHIRExporter.GenerateExport(tdb, templates, new Trifolia.Shared.IGSettingsManager(tdb)); Assert.IsNotNull(export, "Expected generated export not to be null"); Assert.AreNotEqual(0, export.Length, "Expected generated export not to be empty"); }
public void TestImportBundle() { MockObjectRepository tdb = new MockObjectRepository(); tdb.InitializeFHIRRepository(); tdb.FindOrAddImplementationGuide(MockObjectRepository.DEFAULT_FHIR_DSTU1_IG_TYPE_NAME, "Unowned FHIR DSTU1 Profiles"); string bundleXml = Helper.GetSampleContents("Trifolia.Test.DocSamples.FHIR.DSTU1.bundle.xml"); FHIRImporter importer = new FHIRImporter(tdb, false); importer.Import(bundleXml); try { importer.Import(bundleXml); Assert.Fail("Expected an exception to be thrown when importing FHIR profiles with 'create' option, when profile already exists"); } catch { } importer = new FHIRImporter(tdb, true); importer.Import(bundleXml); }