Example #1
0
        /// <summary>
        /// Used to test green artifact generation.
        /// </summary>
        /// <returns></returns>
        public static MockObjectRepository GenerateGreenMockDataset1()
        {
            MockObjectRepository mockRepo = new MockObjectRepository();

            mockRepo.FindOrCreateCodeSystem("SNOMED CT", "6.96");
            mockRepo.FindOrCreateCodeSystem("HL7ActStatus", "113883.5.14");
            mockRepo.FindOrCreateValueSet("GenderCode", "11.1");

            ImplementationGuideType igType      = mockRepo.FindOrCreateImplementationGuideType(Constants.IGTypeNames.CDA, Constants.IGTypeSchemaLocations.CDA, Constants.IGTypePrefixes.CDA, Constants.IGTypeNamespaces.CDA);
            TemplateType            docType     = mockRepo.FindOrCreateTemplateType(igType, "Document", "ClinicalDocument", "ClinicalDocument", 1);
            TemplateType            sectionType = mockRepo.FindOrCreateTemplateType(igType, "Section", "section", "Section", 2);

            mockRepo.FindOrCreateDataType(igType, "II");
            mockRepo.FindOrCreateDataType(igType, "INT");
            mockRepo.FindOrCreateDataType(igType, "TS");
            mockRepo.FindOrCreateDataType(igType, "CE");

            ImplementationGuide ig1 = mockRepo.FindOrCreateImplementationGuide(igType, "Test IG 1");
            Template            t1  = mockRepo.CreateTemplate("urn:oid:1.2.3.4", docType, "Test Template 1", ig1, null, null, null);

            TemplateConstraint tc1       = mockRepo.AddConstraintToTemplate(t1, null, null, "code", "SHALL", "1..1", "CE");
            TemplateConstraint tc1_1     = mockRepo.AddConstraintToTemplate(t1, tc1, null, "@code", "SHALL", "1..1", null, "SHALL", "1234-x", "Test Doc Code", null, null);
            TemplateConstraint tc1_2     = mockRepo.AddConstraintToTemplate(t1, tc1, null, "@codeSystem", "SHALL", "1..1", null, "SHALL", "1.5.4.2.3", "Test Code System OID", null, null);
            TemplateConstraint tc2       = mockRepo.AddConstraintToTemplate(t1, null, null, "setId", "SHALL", "1..1", "II");
            TemplateConstraint tc3       = mockRepo.AddConstraintToTemplate(t1, null, null, "versionNumber", "SHALL", "1..1", "INT");
            TemplateConstraint tc4       = mockRepo.AddConstraintToTemplate(t1, null, null, "recordTarget", "SHALL", "1..*", null);
            TemplateConstraint tc4_1     = mockRepo.AddConstraintToTemplate(t1, tc4, null, "patientRole", "SHALL", "1..1", null);
            TemplateConstraint tc4_1_1   = mockRepo.AddConstraintToTemplate(t1, tc4_1, null, "id", "SHALL", "1..1", "II");
            TemplateConstraint tc4_1_2   = mockRepo.AddConstraintToTemplate(t1, tc4_1, null, "patient", "SHALL", "1..1", null);
            TemplateConstraint tc4_1_2_1 = mockRepo.AddConstraintToTemplate(t1, tc4_1_2, null, "birthTime", "SHALL", "1..1", "TS");
            TemplateConstraint tc4_1_2_2 = mockRepo.AddConstraintToTemplate(t1, tc4_1_2, null, "administrativeGenderCode", "SHALL", "1..1", "CE");

            return(mockRepo);
        }
Example #2
0
        public void GenerateXMLTest()
        {
            MockObjectRepository mockTdb = new MockObjectRepository();

            mockTdb.InitializeCDARepository();

            ImplementationGuide ig       = mockTdb.FindOrCreateImplementationGuide(Constants.IGTypeNames.CDA, "Test IG", null, DateTime.Now);
            Template            template = mockTdb.CreateTemplate("urn:oid:2.16.22.22.11", "Document", "Test Doc Type", ig, "ClinicalDocument", "ClinicalDocument", "Test Description");
            var tca1 = mockTdb.AddConstraintToTemplate(template, null, null, "@classCode", "SHALL", "1..1", value: "test1");
            var tca2 = mockTdb.AddConstraintToTemplate(template, null, null, "@moodCode", "SHALL", "1..1", value: "test2");
            var tc1  = mockTdb.AddConstraintToTemplate(template, null, null, "entryRelationship", "SHALL", "1..1");
            var tc2  = mockTdb.AddConstraintToTemplate(template, tc1, null, "observation", "SHOULD", "0..1");
            var tc3  = mockTdb.AddConstraintToTemplate(template, tc2, null, "value", "SHALL", "1..1", "CD", value: "4321", displayName: "Test");

            template.TemplateSamples = new System.Data.Entity.Core.Objects.DataClasses.EntityCollection <TemplateSample>();
            template.TemplateSamples.Add(new TemplateSample()
            {
                XmlSample = "<test><example>VALUE</example></test>"
            });

            List <Template> templates = new List <Template>();

            templates.Add(template);

            IGSettingsManager igSettings = new IGSettingsManager(mockTdb, ig.Id);
            TemplateExporter  exporter   = new TemplateExporter(templates, mockTdb, ig.Id);
            string            export     = exporter.GenerateXML();

            Assert.IsFalse(string.IsNullOrEmpty(export));
        }
Example #3
0
        public void Setup()
        {
            this.tdb = new MockObjectRepository();

            MemoryStream           docStream = new MemoryStream();
            WordprocessingDocument document  = WordprocessingDocument.Create(docStream, WordprocessingDocumentType.Document);

            this.body              = new Body();
            this.mainPart          = document.AddMainDocumentPart();
            this.mainPart.Document = new Document(this.body);

            // Dummy Data
            CodeSystem snomed = this.tdb.FindOrCreateCodeSystem("SNOMED-CT", "1.2.3.4");

            this.vs1 = this.tdb.FindOrCreateValueSet("ValueSet 1", "1.2.3");
            this.tdb.FindOrCreateValueSetMember(this.vs1, snomed, "1", "One");
            this.tdb.FindOrCreateValueSetMember(this.vs1, snomed, "2", "Two");
            this.tdb.FindOrCreateValueSetMember(this.vs1, snomed, "3", "Three");

            this.vs2 = this.tdb.FindOrCreateValueSet("ValueSet 2", "1.2.3.4");
            this.tdb.FindOrCreateValueSetMember(this.vs2, snomed, "1", "One");
            this.tdb.FindOrCreateValueSetMember(this.vs2, snomed, "2", "Two");

            this.vs3 = this.tdb.FindOrCreateValueSet("ValueSet 3", "1.2.3.4.5");
            this.vs3.IsIncomplete = true;
            this.vs3.Source       = "http://www.lantanagroup.com";
        }
Example #4
0
        public void FindTemplate_Remote_Test()
        {
            HttpRequestMessage request = new HttpRequestMessage();

            request.RequestUri = new Uri("http://test:100/");
            MockObjectRepository repo = new MockObjectRepository();

            repo.InitializeFHIR2Repository();
            repo.InitializeLCG();

            ResourceReference reference = new ResourceReference();

            reference.Reference = "http://test.com/FHIR/StructureDefinition/test";

            MockWebClient       webClient      = new MockWebClient();
            var                 dafPatientJson = Trifolia.Test.Helper.GetSampleContents("Trifolia.Test.DocSamples.daf-patient_struc_def.json");
            StructureDefinition strucDef       = (StructureDefinition)FhirParser.ParseResourceFromJson(dafPatientJson);

            webClient.ExpectContent("http://test.com/FHIR/StructureDefinition/test", dafPatientJson);
            var foundTemplate = Shared.FindTemplate(request, webClient, repo, reference);

            Assert.IsNotNull(foundTemplate);
            Assert.AreEqual(1, foundTemplate.Id);
            Assert.AreEqual(strucDef.Name, foundTemplate.Name);
        }
Example #5
0
        public void Setup()
        {
            this.mockRepo = TestDataGenerator.GenerateMockDataset1();
            IEnumerable <int> templateIds = (from t in this.mockRepo.Templates
                                             select t.Id);

            ImplementationGuideGenerator generator = new ImplementationGuideGenerator(this.mockRepo,
                                                                                      1, templateIds);
            ExportSettings lSettings = new ExportSettings();

            lSettings.Use(s =>
            {
                s.GenerateTemplateConstraintTable = true;
                s.GenerateTemplateContextTable    = true;
                s.GenerateDocTemplateListTable    = true;
                s.GenerateDocContainmentTable     = true;
                s.AlphaHierarchicalOrder          = false;
                s.DefaultValueSetMaxMembers       = 0;
                s.GenerateValueSetAppendix        = false;
                s.IncludeXmlSamples     = false;
                s.IncludeChangeList     = false;
                s.IncludeTemplateStatus = true;
                s.IncludeNotes          = true;
            });

            generator.BuildImplementationGuide(lSettings);
            this.docBytes = generator.GetDocument();

            this.docContents = GetWordDocumentContents(docBytes);
            this.doc         = ReadWordDocXml(docContents, out this.nsMgr);
        }
        public void GetRecursiveTemplates_ThreeVersions_V3Changed()
        {
            MockObjectRepository tdb = new MockObjectRepository();

            tdb.InitializeCDARepository();

            // Version 1
            var implementationGuide1 = tdb.FindOrAddImplementationGuide(MockObjectRepository.DEFAULT_CDA_IG_TYPE_NAME, "IG V1");
            var template1            = tdb.GenerateTemplate("1.2.3.4", "Document", "Doc Template V1", implementationGuide1, "ClinicalDocument", "ClinicalDocument");

            // Version 2
            var implementationGuide2 = tdb.FindOrAddImplementationGuide(MockObjectRepository.DEFAULT_CDA_IG_TYPE_NAME, "IG V2", previousVersion: implementationGuide1);

            // Version 3
            var implementationGuide3 = tdb.FindOrAddImplementationGuide(MockObjectRepository.DEFAULT_CDA_IG_TYPE_NAME, "IG V3", previousVersion: implementationGuide2);
            var template2            = tdb.GenerateTemplate("1.2.3.4", "Document", "Doc Template V3", implementationGuide3, "ClinicalDocument", "ClinicalDocument", previousVersion: template1);

            // Check list of templates for version 1
            var templates = implementationGuide1.GetRecursiveTemplates(tdb);

            Assert.IsNotNull(templates, "Version 1 returned null value");
            Assert.AreEqual(1, templates.Count, "Version 1 returned incorrect number of templates");

            // Check list of templates for version 2
            templates = implementationGuide2.GetRecursiveTemplates(tdb);
            Assert.IsNotNull(templates, "Version 2 returned null value");
            Assert.AreEqual(1, templates.Count, "Version 2 returned incorrect number of templates");

            // Check list of templates for version 3
            templates = implementationGuide3.GetRecursiveTemplates(tdb);
            Assert.IsNotNull(templates, "Version 3 returned null value");
            Assert.AreEqual(1, templates.Count, "Version 3 returned incorrect number of templates");
        }
Example #7
0
        public static void Setup(TestContext context)
        {
            ExportTests.tdb = new MockObjectRepository();
            TrifoliaImporter importer = new TrifoliaImporter(ExportTests.tdb);

            ExportTests.tdb.InitializeFHIR3Repository();
            ExportTests.tdb.InitializeLCGAndLogin();

            string importContent = Helper.GetSampleContents(IMPORT_XML);
            var    importModel   = ImportModel.Deserialize(importContent);

            var importStatus = importer.Import(importModel);

            Assert.IsTrue(importStatus.Success, "Expected import to succeed");
            Assert.AreNotEqual(importStatus.ImplementationGuides.Count, 0, "Expected import to include implementation guides");

            ImplementationGuide ig = ExportTests.tdb.ImplementationGuides.SingleOrDefault(y => y.Id == importStatus.ImplementationGuides.First().InternalId);
            var schema             = ig.ImplementationGuideType.GetSimpleSchema();
            ImplementationGuideExporter exporter = new ImplementationGuideExporter(ExportTests.tdb, schema, "localhost", "http");

            ExportTests.exportedBundle = exporter.GetImplementationGuides(implementationGuideId: ig.Id, include: "ImplementationGuide:resource");

            ExportTests.exportedXml = FhirSerializer.SerializeResourceToXml(ExportTests.exportedBundle);

            Assert.IsNotNull(ExportTests.exportedXml);
        }
        public void GetRecursiveTemplates_ContainedNotInferred_MultiVersions()
        {
            MockObjectRepository tdb = new MockObjectRepository();

            tdb.InitializeCDARepository();

            var externalIG  = tdb.FindOrAddImplementationGuide(MockObjectRepository.DEFAULT_CDA_IG_TYPE_NAME, "External IG");
            var exTemplate1 = tdb.GenerateTemplate("4.3.2.1", "Entry", "Ext Entry Template", externalIG, "observation", "Observation");

            // Version 1, create the template
            var implementationGuide1 = tdb.FindOrAddImplementationGuide(MockObjectRepository.DEFAULT_CDA_IG_TYPE_NAME, "IG V1");
            var template1            = tdb.GenerateTemplate("1.2.3.4", "Document", "Doc Template V1", implementationGuide1, "ClinicalDocument", "ClinicalDocument");
            var tc1 = tdb.GenerateConstraint(template1, null, null, "entryRelationship", "SHALL", "1..1");

            tdb.GenerateConstraint(template1, tc1, exTemplate1, "observation", "SHALL", "1..1");

            // Version 2, deprecate the template, remove contained external template
            var implementationGuide2 = tdb.FindOrAddImplementationGuide(MockObjectRepository.DEFAULT_CDA_IG_TYPE_NAME, "IG V2", previousVersion: implementationGuide1);
            var template2            = tdb.GenerateTemplate("1.2.3.4", "Document", "Doc Template V2", implementationGuide2, "ClinicalDocument", "ClinicalDocument", previousVersion: template1);

            // Check list of templates for version 1
            var templates = implementationGuide1.GetRecursiveTemplates(tdb, inferred: false);

            Assert.IsNotNull(templates, "Version 1 returned null value");
            Assert.AreEqual(1, templates.Count, "Version 1 returned incorrect number of templates");

            // Check list of templates for version 2
            templates = implementationGuide2.GetRecursiveTemplates(tdb, inferred: false);
            Assert.IsNotNull(templates, "Version 2 returned null value");
            Assert.AreEqual(1, templates.Count, "Version 2 returned incorrect number of templates");
        }
        public void ExportTemplatesModelTest1()
        {
            MockObjectRepository tdb = new MockObjectRepository();

            tdb.InitializeCDARepository();

            Organization        org        = tdb.FindOrAddOrganization("LCG Test");
            ImplementationGuide ig         = tdb.FindOrAddImplementationGuide(tdb.FindImplementationGuideType(MockObjectRepository.DEFAULT_CDA_IG_TYPE_NAME), "Test Implementation Guide");
            IGSettingsManager   igSettings = new IGSettingsManager(tdb, ig.Id);

            Template template = tdb.GenerateTemplate("1.2.3.4", "Document", "Test Template", ig, "observation", "Observation", "Test Description", "Test Notes", org);
            var      tc1      = tdb.GenerateConstraint(template, null, null, "entryRelationship", "SHALL", "1..1");
            var      tc2      = tdb.GenerateConstraint(template, tc1, null, "observation", "SHOULD", "0..1");
            var      tc3      = tdb.GenerateConstraint(template, tc2, null, "value", "SHALL", "1..1", "CD", value: "4321", displayName: "Test");

            tc3.Description = "Test description";
            tc3.Label       = "Test Label";
            var tc4 = tdb.GeneratePrimitive(template, null, "SHALL", "This is a test");

            ExportTemplate export = template.Export(tdb, igSettings);

            Assert.IsNotNull(export);
            Assert.AreEqual(template.Oid, export.identifier);
            Assert.AreEqual(template.Name, export.title);
            Assert.AreEqual(template.TemplateType.Name, export.templateType);
            Assert.AreEqual(template.PrimaryContext, export.context);
            Assert.AreEqual(template.PrimaryContextType, export.contextType);
            Assert.AreEqual(template.Description, export.Description);
            Assert.AreEqual(template.Notes, export.Notes);
            Assert.AreEqual(template.OrganizationName, export.organizationName);

            // Assert constraints
            Assert.IsNotNull(export.Constraint);
            Assert.AreEqual(2, export.Constraint.Count);

            // tc1
            Assert.AreEqual(tc1.Context, export.Constraint[0].context);
            Assert.AreEqual(ExportConformanceTypes.SHALL, export.Constraint[0].conformance);
            Assert.AreEqual(tc1.Cardinality, export.Constraint[0].cardinality);

            // tc4
            Assert.IsNull(export.Constraint[1].context);
            Assert.AreEqual(true, export.Constraint[1].isPrimitive);
            Assert.AreEqual(tc4.PrimitiveText, export.Constraint[1].NarrativeText);

            // tc2
            Assert.AreEqual(1, export.Constraint[0].Constraint.Count);
            Assert.AreEqual(tc2.Context, export.Constraint[0].Constraint[0].context);
            Assert.AreEqual(ExportConformanceTypes.SHOULD, export.Constraint[0].Constraint[0].conformance);
            Assert.AreEqual(tc2.Cardinality, export.Constraint[0].Constraint[0].cardinality);

            // tc3
            Assert.AreEqual(1, export.Constraint[0].Constraint[0].Constraint.Count);
            Assert.AreEqual(tc3.Context, export.Constraint[0].Constraint[0].Constraint[0].context);
            Assert.AreEqual(ExportConformanceTypes.SHALL, export.Constraint[0].Constraint[0].Constraint[0].conformance);
            Assert.AreEqual(tc3.Cardinality, export.Constraint[0].Constraint[0].Constraint[0].cardinality);
            Assert.AreEqual(tc3.Description, export.Constraint[0].Constraint[0].Constraint[0].Description);
            Assert.AreEqual(tc3.Label, export.Constraint[0].Constraint[0].Constraint[0].Label);
            Assert.IsFalse(string.IsNullOrEmpty(export.Constraint[0].Constraint[0].Constraint[0].Description));
        }
        public void ExportTemplatesModelTest2()
        {
            MockObjectRepository tdb = new MockObjectRepository();

            tdb.InitializeCDARepository();

            Organization        org        = tdb.FindOrAddOrganization("LCG Test");
            ImplementationGuide ig         = tdb.FindOrAddImplementationGuide(tdb.FindImplementationGuideType(MockObjectRepository.DEFAULT_CDA_IG_TYPE_NAME), "Test Implementation Guide");
            IGSettingsManager   igSettings = new IGSettingsManager(tdb, ig.Id);

            Template template = tdb.GenerateTemplate("1.2.3.4", "Document", "Test Template", ig, "observation", "Observation", "Test Description", "Test Notes");

            ExportTemplate export = template.Export(tdb, igSettings);

            Assert.IsNotNull(export);
            Assert.AreEqual(template.Oid, export.identifier);
            Assert.AreEqual(template.Name, export.title);
            Assert.AreEqual(template.TemplateType.Name, export.templateType);
            Assert.AreEqual(template.PrimaryContext, export.context);
            Assert.AreEqual(template.PrimaryContextType, export.contextType);
            Assert.AreEqual(template.Description, export.Description);
            Assert.AreEqual(template.Notes, export.Notes);
            Assert.IsNull(export.organizationName);
            Assert.AreEqual(template.OwningImplementationGuide.Name, export.ImplementationGuide.name);
        }
Example #11
0
        public void CloneTemplateTest()
        {
            MockObjectRepository repo = TestDataGenerator.GenerateMockDataset1();
            var      user             = repo.FindOrAddUser("test.user", repo.FindOrAddOrganization("LCG"));
            Template firstTemplate    = repo.Templates.First();

            Template secondTemplate = firstTemplate.CloneTemplate(repo, user.Id);

            repo.Templates.AddObject(secondTemplate);
            Assert.AreNotEqual(firstTemplate.Name, secondTemplate.Name, "Title for the first template should be different than the cloned template.");
            Assert.AreEqual(firstTemplate.Oid + ".1", secondTemplate.Oid, "Expected the second template's oid to have .1 added to it.");

            // Test that other properties were copied
            Assert.AreEqual(firstTemplate.ImplementationGuideTypeId, secondTemplate.ImplementationGuideTypeId);
            Assert.AreEqual(firstTemplate.TemplateTypeId, secondTemplate.TemplateTypeId);
            Assert.AreEqual(firstTemplate.OwningImplementationGuideId, secondTemplate.OwningImplementationGuideId);
            Assert.AreEqual(firstTemplate.ImpliedTemplateId, secondTemplate.ImpliedTemplateId);
            Assert.AreEqual(firstTemplate.PrimaryContext, secondTemplate.PrimaryContext);
            Assert.AreEqual(firstTemplate.PrimaryContextType, secondTemplate.PrimaryContextType);
            Assert.AreEqual(firstTemplate.IsOpen, secondTemplate.IsOpen);

            // Test that making more than 10 copies properly generates the title and oid
            Template lastCopiedTemplate = null;
            int      count = 1;

            while (count < 11)
            {
                lastCopiedTemplate = firstTemplate.CloneTemplate(repo, user.Id);
                repo.Templates.AddObject(lastCopiedTemplate);
                count++;
            }

            Assert.AreEqual(firstTemplate.Oid + ".12", lastCopiedTemplate.Oid, "Generated oid for copied templates is not working when there are more than 10 copies.");
            Assert.AreEqual(firstTemplate.Name + " (Copy 11)", lastCopiedTemplate.Name, "Genrated title for copied templates is not working when there are more than 10 copies.");
        }
        public void TestSetup()
        {
            this.tdb = new MockObjectRepository();
            this.tdb.InitializeCDARepository();

            CodeSystem cs = tdb.FindOrCreateCodeSystem("LOINC", "1.2.3.4.5");

            this.vs1 = tdb.FindOrCreateValueSet("Test Valueset 1", "1.2.3.4");
            this.tdb.FindOrCreateValueSetMember(this.vs1, cs, "1", "One", "active", "1/1/2000");
            this.tdb.FindOrCreateValueSetMember(this.vs1, cs, "2", "Two", "active", "1/1/2000");
            this.tdb.FindOrCreateValueSetMember(this.vs1, cs, "1", "One", "inactive", "1/1/2001");
            this.tdb.FindOrCreateValueSetMember(this.vs1, cs, "3", "Three", "active", "1/1/2001");
            this.tdb.FindOrCreateValueSetMember(this.vs1, cs, "1", "One", "active", "1/1/2002");

            this.vs2 = tdb.FindOrCreateValueSet("Test Valueset 2", "4.3.2.1");
            this.tdb.FindOrCreateValueSetMember(this.vs2, cs, "1", "One");
            this.tdb.FindOrCreateValueSetMember(this.vs2, cs, "2", "Two");
            this.tdb.FindOrCreateValueSetMember(this.vs2, cs, "3", "Three", "inactive", "1/1/2000");
            this.tdb.FindOrCreateValueSetMember(this.vs2, cs, "4", "Four", "active", "1/1/2000");

            this.vs3 = tdb.FindOrCreateValueSet("Test Valueset 3", "1.4.2.3");
            this.tdb.FindOrCreateValueSetMember(this.vs3, cs, "1", "One");
            this.tdb.FindOrCreateValueSetMember(this.vs3, cs, "2", "Two");
            this.tdb.FindOrCreateValueSetMember(this.vs3, cs, "3", "Three", valueSetStatus: "inactive", dateOfValueSetStatus: "08/05/2013");
            this.tdb.FindOrCreateValueSetMember(this.vs3, cs, "4", "Four", valueSetStatus: "active");
            this.tdb.FindOrCreateValueSetMember(this.vs3, cs, "5", "Five");

            this.ig = this.tdb.FindOrCreateImplementationGuide(Constants.IGTypeNames.CDA, "Test IG");
        }
Example #13
0
        public void TestGetTemplates()
        {
            MockObjectRepository mockRepo = new MockObjectRepository();

            mockRepo.InitializeFHIR3Repository();
            mockRepo.InitializeLCGAndLogin();

            var ig       = mockRepo.FindOrAddImplementationGuide(MockObjectRepository.DEFAULT_FHIR_STU3_IG_TYPE_NAME, "Test IG");
            var template = mockRepo.GenerateTemplate("http://test.com/profile1", "Composition", "Test Composition", ig);

            HttpRequestMessage request = new HttpRequestMessage()
            {
                RequestUri = new Uri("http://localhost:8080/api/FHIR3/StructureDefinition")
            };
            HttpRequest  contextRequest  = new HttpRequest(null, "http://localhost:8080/api/FHIR3/StructureDefinition", null);
            HttpResponse contextResponse = new HttpResponse(new StringWriter());

            HttpContext.Current = new HttpContext(contextRequest, contextResponse);

            FHIR3StructureDefinitionController controller = new FHIR3StructureDefinitionController(mockRepo, request);
            var response = controller.GetTemplates();
            var result   = AssertHelper.IsType <NegotiatedContentResult <Bundle> >(response);

            Assert.IsNotNull(result.Content);
            Assert.AreEqual(1, result.Content.Entry.Count);

            var firstEntry = result.Content.Entry.First();

            Assert.AreEqual("http://localhost:8080/api/FHIR3/StructureDefinition/1", firstEntry.FullUrl);
            Assert.IsNotNull(firstEntry.Resource);

            var firstStrucDef = AssertHelper.IsType <StructureDefinition>(firstEntry.Resource);

            Assert.AreEqual("Test-Composition", firstStrucDef.Id);
        }
Example #14
0
        /// <summary>
        ///A test for BuildTransform
        ///</summary>
        //[TestMethod()]
        public void BuildGreenTransformTest()
        {
            MockObjectRepository mockRepo = TestDataGenerator.GenerateGreenMockDataset1();
            int templateId = 1;
            Dictionary <int, int> greenTemplates = new Dictionary <int, int>();

            greenTemplates.Add(templateId, 1);
            GreenTransformGenerator target = new GreenTransformGenerator(mockRepo, greenTemplates, templateId);

            target.BuildTransform();
            string transformXml = target.GetTransform();

            XmlDocument doc = new XmlDocument();

            doc.LoadXml(transformXml);

            XmlNamespaceManager nsManager = new XmlNamespaceManager(doc.NameTable);

            nsManager.AddNamespace("xsl", "http://www.w3.org/1999/XSL/Transform");
            nsManager.AddNamespace("ig", "urn:hl7-org:v3");

            XmlElement testGreenTemplate1 = doc.SelectSingleNode("/xsl:stylesheet/xsl:template[@name='TestGreenTemplate1']", nsManager) as XmlElement;

            Assert.IsNotNull(testGreenTemplate1);

            XmlTestHelper.AssertXmlSingleNode(testGreenTemplate1, nsManager, "ig:ClinicalDocument", "Expected to find a root clinical document node");
            XmlTestHelper.AssertXmlSingleNode(testGreenTemplate1, nsManager, "ig:ClinicalDocument/ig:templateId[@root='1.2.3.4']", "Expected to find a templateId");
            XmlTestHelper.AssertXmlSingleNode(testGreenTemplate1, nsManager, "ig:ClinicalDocument/xsl:element[@name='setId'][xsl:call-template[@name='dataType_II' and xsl:with-param[@name='instance' and @select='VersionSet']]]",
                                              "Expected to find xsl:element for setId");
        }
Example #15
0
        public void TestSuccessfulCreate()
        {
            MockObjectRepository mockRepo = new MockObjectRepository();

            mockRepo.InitializeFHIR3Repository();
            mockRepo.InitializeLCG();

            var strucDefJson             = Helper.GetSampleContents("Trifolia.Test.DocSamples.FHIR.STU3.cqif-questionnaire-strucdef.json");
            StructureDefinition strucDef = (StructureDefinition)FhirParser.ParseResourceFromJson(strucDefJson);

            HttpRequestMessage request = new HttpRequestMessage();

            request.RequestUri = new Uri("http://localhost:8080/api/FHIR3/StructureDefinition");

            HttpRequest  contextRequest  = new HttpRequest(null, "http://localhost:8080/api/FHIR3/StructureDefinition", null);
            HttpResponse contextResponse = new HttpResponse(new StringWriter());

            HttpContext.Current = new HttpContext(contextRequest, contextResponse);

            FHIR3StructureDefinitionController controller = new FHIR3StructureDefinitionController(mockRepo, request);
            var response = controller.CreateStructureDefinition(strucDef);
            var result   = AssertHelper.IsType <TrifoliaApiController.CustomHeadersWithContentResult <StructureDefinition> >(response);

            Assert.AreEqual(HttpStatusCode.Created, result.StatusCode);
            Assert.IsNotNull(result.CustomHeaders["Location"]);
            Assert.AreEqual(result.CustomHeaders["Location"], "http://localhost:8080/api/FHIR3/StructureDefinition/1");

            Assert.IsNotNull(result.Content);
            Assert.AreEqual(strucDef.Name, result.Content.Name);
        }
Example #16
0
        public void TestFailedCreate_Id()
        {
            MockObjectRepository mockRepo = new MockObjectRepository();

            mockRepo.InitializeFHIR3Repository();
            mockRepo.InitializeLCG();

            var strucDefJson             = Helper.GetSampleContents("Trifolia.Test.DocSamples.FHIR.STU3.cqif-questionnaire-strucdef.json");
            StructureDefinition strucDef = (StructureDefinition)FhirParser.ParseResourceFromJson(strucDefJson);

            strucDef.Id = "cqif-questionnaire";

            HttpRequestMessage request = new HttpRequestMessage();

            request.RequestUri = new Uri("http://localhost:8080/api/FHIR3/StructureDefinition");

            HttpRequest  contextRequest  = new HttpRequest(null, "http://localhost:8080/api/FHIR3/StructureDefinition", null);
            HttpResponse contextResponse = new HttpResponse(new StringWriter());

            HttpContext.Current = new HttpContext(contextRequest, contextResponse);

            FHIR3StructureDefinitionController controller = new FHIR3StructureDefinitionController(mockRepo, request);
            var response = controller.CreateStructureDefinition(strucDef);
            var result   = AssertHelper.IsType <NegotiatedContentResult <OperationOutcome> >(response);

            Assert.AreEqual(HttpStatusCode.BadRequest, result.StatusCode);

            Assert.IsNotNull(result.Content);
            Assert.AreEqual(1, result.Content.Issue.Count);
        }
Example #17
0
        public void TestBuildContextStringForAddress_ContainedByMultiple()
        {
            MockObjectRepository tdb = new MockObjectRepository();

            tdb.InitializeCDARepository();

            var igType = tdb.FindImplementationGuideType(Constants.IGTypeNames.CDA);
            var unspecifiedTemplateType = tdb.FindOrCreateTemplateType(igType, MockObjectRepository.DEFAULT_CDA_UNSPECIFIED_TYPE);
            var docTemplateType         = tdb.FindOrCreateTemplateType(igType, Constants.IGTypeNames.CDA);
            var entryTemplateType       = tdb.FindOrCreateTemplateType(igType, MockObjectRepository.DEFAULT_CDA_ENTRY_TYPE);
            var ig = tdb.FindOrCreateImplementationGuide(igType, "Test IG");
            TemplateContextBuilder tcb = new TemplateContextBuilder(tdb, igType, igType.GetSimpleSchema());

            Template addrTemplate = tdb.CreateTemplate("urn:oid:1.2.3.4", unspecifiedTemplateType, "Test Address Template", ig, "addr", "AD");

            Template containingTemplate1 = tdb.CreateTemplate("urn:oid:4.3.2.1", docTemplateType, "Test Doc Template", ig, "ClinicalDocument", "ClinicalDocument");
            var      c1_1 = tdb.AddConstraintToTemplate(containingTemplate1, null, null, "recordTarget", "SHALL", "1..1");
            var      c1_2 = tdb.AddConstraintToTemplate(containingTemplate1, c1_1, null, "patientRole", "SHALL", "1..1");

            tdb.AddConstraintToTemplate(containingTemplate1, c1_2, addrTemplate, "addr", "SHALL", "1..1");

            Template containingTemplate2 = tdb.CreateTemplate("urn:oid:3.2.1.4", entryTemplateType, "Test Entry Template", ig, "observation", "Observation");
            var      c2_1 = tdb.AddConstraintToTemplate(containingTemplate2, null, null, "participant", "SHALL", "1..1");
            var      c2_2 = tdb.AddConstraintToTemplate(containingTemplate2, c2_1, null, "participantRole", "SHALL", "1..1");

            tdb.AddConstraintToTemplate(containingTemplate2, c2_2, addrTemplate, "addr", "SHALL", "1..1");

            var contextString = tcb.BuildContextString(addrTemplate);

            Assert.AreEqual("cda:ClinicalDocument[cda:templateId[@root='4.3.2.1']]/cda:recordTarget/cda:patientRole/cda:addr | cda:observation[cda:templateId[@root='3.2.1.4']]/cda:participant/cda:participantRole/cda:addr", contextString);
        }
        public void ExportTrifoliaTest()
        {
            MockObjectRepository mockRepo = TestDataGenerator.GenerateMockDataset2();

            int            implementationGuideId = 1;
            TrifoliaExport target = new TrifoliaExport(mockRepo, implementationGuideId);

            target.BuildExport();
            string expected = string.Empty;
            string actual   = target.GetExport();

            bool foundContext             = actual.Contains("INSERT INTO `dictionarycontext` (`ID`, `context`, `lastUpdate`) VALUES (1, 'value',");
            bool foundCodeSystem          = actual.Contains("INSERT INTO `dictionarycontext` (`ID`, `OID`, `codeSystemName`, `description`, `lastUpdate`) VALUES (1, '6.96', 'SNOMED CT',");
            bool foundValueSet            = actual.Contains("INSERT INTO `valueset` (`ID`, `OID`, `valueSetName`, `valueSetCode`, `description`, `intensional`, `intensionalDefinition`, `lastUpdate`) VALUES (1, '11.1', 'GenderCode', ");
            bool foundValueSetMember      = actual.Contains("INSERT INTO `valuesetmember` (`ID`, `valueSetId`, `valueSetOId`, `codeSystemId`, `code`, `codeSystemOID`, `displayName`, `dateOfValueSetStatus`, `lastUpdate`) VALUES (3, 1, '11.1', '3', 'U', '1.2.3', 'Undetermined', '1/2/2012 12:00:00 AM',");
            bool foundConformance         = actual.Contains("INSERT INTO `conformance_type` (`id`, `conftype`, `lastUpdate`) VALUES (1, 'SHALL',");
            bool foundTemplateType        = actual.Contains("INSERT INTO `template_type` (`id`, `templatetype`, `lastUpdate`) VALUES (1, 'Document',");
            bool foundImplementationGuide = actual.Contains("INSERT INTO `implementationguide` (`id`, `title`, `lastUpdate`) VALUES (1, 'The IG',");
            bool foundUser                  = actual.Contains("INSERT INTO `tdb_users` (id, user_name, user_password) VALUES (1,'defaultUser','ž·Ó');");
            bool foundTemplate              = actual.Contains("INSERT INTO `template` (`ID`, `OID`, `isOpen`, `title`, `templatetype`, `description`, `keywords`, `primaryContext`, `impliedTemplate`, `notes`, `lastUpdate`, `uname`) VALUES (1, '1.2.3.4.5.6', 0, 'Test Template 1', 1, 'Test Description 1', NULL, NULL, NULL, 'Test Notes 1',");
            bool foundConstraint            = actual.Contains("INSERT INTO `template_constraint` (`ID`, `parentConstraintID`, `templateID`, `order`, `isBranch`, `businessConformance`, `cardinality`, `context`, `containedTemplate`, `isPrimitive`, `constraintNarrative`, `valueConformance`, `staticDynamic`, `valueSetOID`, `version`, `codeOrValue`, `codeSystemOID`, `displayName`, `datatype`, `schematronTest`, `lastUpdate`, `uname`) VALUES (1, NULL, 1, 0, 0, 1, '1..1', 1, NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,");
            bool foundIGTemplateAssociation = actual.Contains("INSERT INTO `associationtemplateimplementationguide` (`ID`, `templateId`, `implementationGuideId`, `lastUpdate`) VALUES (1, 1, 1,");

            Assert.IsTrue(foundContext, "Expected to find an insert statement for context 'statusCode'");
            Assert.IsTrue(foundCodeSystem, "Expected to find an insert statement for 'SNOMED CT (6.96)'");
            Assert.IsTrue(foundValueSet, "Expected to find an insert statement for valueset '11.1'");
            Assert.IsTrue(foundValueSetMember, "Expected to find an insert statement for valueset member '3'");
            Assert.IsTrue(foundConformance, "Expected to find an insert statement for conformance 'SHALL'");
            Assert.IsTrue(foundTemplateType, "Expected to find an insert statement for template type 'Document'");
            Assert.IsTrue(foundImplementationGuide, "Expected to find an insert statement for implementation guide 'The IG'");
            Assert.IsTrue(foundUser, "Expected to find an insert statement for user 'defaultUser'");
            Assert.IsTrue(foundTemplate, "Expected to find an insert statement for template 'Test Template 1'");
            Assert.IsTrue(foundIGTemplateAssociation, "Expected to find an insert statement associating ig 'The IG' to template 'Test Template 1'");
        }
        public void TestParseColumnsHeaders()
        {
            MockObjectRepository repo        = new MockObjectRepository();
            BulkCopyController   controller  = new BulkCopyController(repo);
            ExcelUpload          uploadModel = new ExcelUpload()
            {
                ExcelFile        = this.exampleContent,
                FirstRowIsHeader = true
            };

            List <ExcelSheet> sheets = controller.Parse(uploadModel);

            Assert.IsNotNull(sheets);
            Assert.AreEqual(2, sheets.Count);

            var firstSheet  = sheets[0];
            var secondSheet = sheets[1];

            Assert.IsNotNull(firstSheet.Columns);
            Assert.AreEqual(4, firstSheet.Columns.Count);
            Assert.AreEqual("A", firstSheet.Columns[0].Letter);
            Assert.AreEqual("Name", firstSheet.Columns[0].Name);
            Assert.AreEqual("B", firstSheet.Columns[1].Letter);
            Assert.AreEqual("OID", firstSheet.Columns[1].Name);

            Assert.IsNotNull(secondSheet.Columns);
            Assert.AreEqual(15, secondSheet.Columns.Count);
            Assert.AreEqual("A", secondSheet.Columns[0].Letter);
            Assert.AreEqual("Template", secondSheet.Columns[0].Name);
            Assert.AreEqual("B", secondSheet.Columns[1].Letter);
            Assert.AreEqual("Number", secondSheet.Columns[1].Name);
        }
        public void Setup()
        {
            this.tdb = new MockObjectRepository();
            this.tdb.InitializeCDARepository();

            this.igType       = this.tdb.FindImplementationGuideType(Constants.IGTypeNames.CDA);
            this.igTypeSchema = this.igType.GetSimpleSchema();
        }
Example #21
0
        public void Setup()
        {
            this.tdb = new MockObjectRepository();
            this.tdb.InitializeFHIRRepository();
            this.tdb.InitializeLCGAndLogin();

            this.ig = this.tdb.FindOrAddImplementationGuide(MockObjectRepository.DEFAULT_FHIR_DSTU1_IG_TYPE_NAME, "Test IG");
        }
Example #22
0
        public void Setup()
        {
            this.mockRepo = new MockObjectRepository();

            cdaType      = this.mockRepo.FindOrCreateImplementationGuideType(Constants.IGTypeNames.CDA, string.Empty, string.Empty, string.Empty);
            documentType = this.mockRepo.FindOrCreateTemplateType(cdaType, "Document Templates", "ClinicalDocument", "ClinicalDocument", 1);
            ig           = this.mockRepo.FindOrCreateImplementationGuide(cdaType, "Test");
        }
        public void Setup()
        {
            this.mockRepo = new MockObjectRepository();

            cdaType      = this.mockRepo.FindOrCreateImplementationGuideType(MockObjectRepository.DEFAULT_CDA_IG_TYPE_NAME, string.Empty, string.Empty, string.Empty);
            documentType = this.mockRepo.FindOrCreateTemplateType(cdaType, "Document Templates", "ClinicalDocument", "ClinicalDocument", 1);
            ig           = this.mockRepo.FindOrAddImplementationGuide(cdaType, "Test");
        }
Example #24
0
        public void ExportTemplatesTest()
        {
            MockObjectRepository tdb        = TestDataGenerator.GenerateMockDataset1();
            List <Template>      templates  = tdb.Templates.ToList();
            IGSettingsManager    igSettings = new IGSettingsManager(tdb);

            TemplateExporter exporter = new TemplateExporter(tdb, templates, igSettings);
            string           actual   = exporter.GenerateXMLExport();

            Assert.IsNotNull(actual, "Export should have produced content.");
            Assert.AreNotEqual(string.Empty, actual, "Export should have produced content.");

            XmlDocument exportDoc = new XmlDocument();

            exportDoc.LoadXml(actual);

            XmlNamespaceManager nsManager = new XmlNamespaceManager(exportDoc.NameTable);

            nsManager.AddNamespace("lcg", "http://www.lantanagroup.com");

            XmlNodeList templateNodes = exportDoc.DocumentElement.SelectNodes("lcg:Template", nsManager);

            Assert.IsNotNull(templateNodes, "Did not find any templates in export.");
            Assert.AreEqual(4, templateNodes.Count, "Export should have produced three (4) Template elements.");

            XmlAttribute identifierAttribute = templateNodes[0].Attributes["identifier"];
            XmlAttribute implementationGuideTypeAttribute = templateNodes[0].Attributes["implementationGuideType"];
            XmlAttribute templateTypeAttribute            = templateNodes[0].Attributes["templateType"];
            XmlAttribute titleAttribute    = templateNodes[0].Attributes["title"];
            XmlAttribute bookmarkAttribute = templateNodes[0].Attributes["bookmark"];

            Assert.IsNotNull(identifierAttribute, "Couldn't find identifier attribute on Template.");
            Assert.AreEqual("1.2.3.4.5", identifierAttribute.Value, "Template's identifier has an incorrect value.");

            Assert.IsNotNull(implementationGuideTypeAttribute, "Couldn't find implementationGuideType attribute on Template.");
            Assert.AreEqual(MockObjectRepository.DEFAULT_CDA_IG_TYPE_NAME, implementationGuideTypeAttribute.Value, "Template's implementationGuideType has an incorrect value.");

            Assert.IsNotNull(templateTypeAttribute, "Couldn't find templateType attribute on Template.");
            Assert.AreEqual("Document", templateTypeAttribute.Value, "Template's templateType has an incorrect value.");

            Assert.IsNotNull(titleAttribute, "Couldn't find title attribute on Template.");
            Assert.AreEqual("Test Template 1", titleAttribute.Value, "Template's title has an incorrect value.");

            Assert.IsNotNull(bookmarkAttribute, "Couldn't find bookmark attribute on Template.");
            Assert.AreEqual("D_Test_Template_1", bookmarkAttribute.Value, "Template's bookmark has an incorrect value.");

            XmlNodeList constraintNodes = templateNodes[0].SelectNodes("lcg:Constraint", nsManager);

            Assert.IsNotNull(constraintNodes, "Did not find any constraints in the first template.");
            Assert.AreEqual(3, constraintNodes.Count, "Did not find the correct number of root-level constraints in the first exported template.");

            XmlNodeList childConstraintNodes = constraintNodes[1].SelectNodes("lcg:Constraint", nsManager);

            Assert.IsNotNull(childConstraintNodes, "Did not find any grand-child constraints in the first template.");
            Assert.AreEqual(1, childConstraintNodes.Count, "Did not find the correct number of grand-child constraints in the first exported template.");
        }
        public void MyTestInitialize()
        {
            this.mockRepo = TestDataGenerator.GenerateMockDataset2();

            ImplementationGuide ig = this.mockRepo.ImplementationGuides.SingleOrDefault(y => y.Name == TestDataGenerator.DS2_IG_NAME);

            this.igSettings            = new IGSettingsManager(this.mockRepo, ig.Id);
            this.igTypePlugin          = ig.ImplementationGuideType.GetPlugin();
            this.linkContainedTemplate = false;
        }
Example #26
0
        public static void Initialize(TestContext context)
        {
            tdb = new MockObjectRepository();

            using (MemoryStream ms = new MemoryStream())
            {
                doc = WordprocessingDocument.Create(ms, WordprocessingDocumentType.Document);
                mdp = doc.AddMainDocumentPart();
            }
        }
Example #27
0
        /// <summary>
        /// Used to test green artifact generation.
        /// </summary>
        /// <returns></returns>
        public static MockObjectRepository GenerateGreenMockDataset1()
        {
            MockObjectRepository mockRepo = new MockObjectRepository();

            mockRepo.FindOrCreateCodeSystem("SNOMED CT", "6.96");
            mockRepo.FindOrCreateCodeSystem("HL7ActStatus", "113883.5.14");
            mockRepo.FindOrCreateValueSet("GenderCode", "11.1");

            ImplementationGuideType igType      = mockRepo.FindOrCreateImplementationGuideType("CDA", "CDA.xsd", "cda", "urn:hl7-org:v3");
            TemplateType            docType     = mockRepo.FindOrCreateTemplateType(igType, "Document", "ClinicalDocument", "ClinicalDocument", 1);
            TemplateType            sectionType = mockRepo.FindOrCreateTemplateType(igType, "Section", "section", "Section", 2);

            mockRepo.GenerateDataType(igType, "II");
            mockRepo.GenerateDataType(igType, "INT");
            mockRepo.GenerateDataType(igType, "TS");
            mockRepo.GenerateDataType(igType, "CE");

            ImplementationGuide ig1 = mockRepo.FindOrAddImplementationGuide(igType, "Test IG 1");
            Template            t1  = mockRepo.GenerateTemplate("urn:oid:1.2.3.4", docType, "Test Template 1", ig1, null, null, null);

            TemplateConstraint tc1       = mockRepo.GenerateConstraint(t1, null, null, "code", "SHALL", "1..1", "CE");
            TemplateConstraint tc1_1     = mockRepo.GenerateConstraint(t1, tc1, null, "@code", "SHALL", "1..1", null, "SHALL", "1234-x", "Test Doc Code", null, null);
            TemplateConstraint tc1_2     = mockRepo.GenerateConstraint(t1, tc1, null, "@codeSystem", "SHALL", "1..1", null, "SHALL", "1.5.4.2.3", "Test Code System OID", null, null);
            TemplateConstraint tc2       = mockRepo.GenerateConstraint(t1, null, null, "setId", "SHALL", "1..1", "II");
            TemplateConstraint tc3       = mockRepo.GenerateConstraint(t1, null, null, "versionNumber", "SHALL", "1..1", "INT");
            TemplateConstraint tc4       = mockRepo.GenerateConstraint(t1, null, null, "recordTarget", "SHALL", "1..*", null);
            TemplateConstraint tc4_1     = mockRepo.GenerateConstraint(t1, tc4, null, "patientRole", "SHALL", "1..1", null);
            TemplateConstraint tc4_1_1   = mockRepo.GenerateConstraint(t1, tc4_1, null, "id", "SHALL", "1..1", "II");
            TemplateConstraint tc4_1_2   = mockRepo.GenerateConstraint(t1, tc4_1, null, "patient", "SHALL", "1..1", null);
            TemplateConstraint tc4_1_2_1 = mockRepo.GenerateConstraint(t1, tc4_1_2, null, "birthTime", "SHALL", "1..1", "TS");
            TemplateConstraint tc4_1_2_2 = mockRepo.GenerateConstraint(t1, tc4_1_2, null, "administrativeGenderCode", "SHALL", "1..1", "CE");

            // Green Info

            GreenTemplate gt1 = new GreenTemplate()
            {
                Id         = 1,
                Template   = t1,
                TemplateId = t1.Id,
                Name       = "Test Green Template 1"
            };

            mockRepo.GreenTemplates.AddObject(gt1);
            t1.GreenTemplates.Add(gt1);

            GreenConstraint gc1 = mockRepo.GenerateGreenConstraint(gt1, tc2, null, 1, "VersionSet", true);
            GreenConstraint gc2 = mockRepo.GenerateGreenConstraint(gt1, tc3, null, 2, "VersionNumber", true);
            GreenConstraint gc3 = mockRepo.GenerateGreenConstraint(gt1, tc4, null, 3, "Patient", false);
            GreenConstraint gc4 = mockRepo.GenerateGreenConstraint(gt1, tc4_1_1, gc3, 1, "Id", true);
            GreenConstraint gc5 = mockRepo.GenerateGreenConstraint(gt1, tc4_1_2_1, gc3, 2, "BirthDate", true);
            GreenConstraint gc6 = mockRepo.GenerateGreenConstraint(gt1, tc4_1_2_2, gc3, 3, "Gender", true);

            return(mockRepo);
        }
Example #28
0
        public void BuildNormativeTransformTest()
        {
            MockObjectRepository mockRepo      = TestDataGeneration.GenerateMockDataset1();
            long implementationGuideId         = 1;
            NormativeTransformGenerator target = new NormativeTransformGenerator(mockRepo, implementationGuideId);

            target.BuildTransform();
            string transform = target.GetTransform();

            Console.WriteLine(transform);
        }
Example #29
0
        public void Setup()
        {
            this.tdb = new MockObjectRepository();
            this.tdb.InitializeCDARepository();
            this.tdb.InitializeFHIR3Repository();

            var fhirIgType = this.tdb.FindImplementationGuideType(Constants.IGTypeNames.FHIR_STU3);

            this.fhirIg           = this.tdb.FindOrCreateImplementationGuide(fhirIgType, "Test FHIR IG");
            this.fhirIgSettings   = new IGSettingsManager(this.tdb, this.fhirIg.Id);
            this.fhirIgTypePlugin = fhirIgType.GetPlugin();
        }
        public void Setup()
        {
            this.mockRepo = new MockObjectRepository();
            this.mockRepo.InitializeCDARepository();
            this.mockRepo.FindOrAddImplementationGuide(MockObjectRepository.DEFAULT_CDA_IG_TYPE_NAME, "Dev Test IG");

            string           importXml = Helper.GetSampleContents("Trifolia.Test.DocSamples.sample2.xml");
            TemplateImporter importer  = new TemplateImporter(this.mockRepo);
            var templates = importer.Import(importXml);

            Assert.AreEqual(0, importer.Errors.Count, "Expected 0 errors from importing sample2.xml");
            Assert.AreEqual(5, templates.Count, "Expected 5 templates to be imported from sample2.xml");
        }