public void GetPlainText_ConformanceValueWithConformanceCodeSystemTest() { // Test 1008 TemplateConstraint constraint = mockRepo.TemplateConstraints.Single(y => y.Id == 9); IGSettingsManager igSettings = new IGSettingsManager(this.mockRepo, constraint.Template.OwningImplementationGuideId); IFormattedConstraint target = FormattedConstraintFactory.NewFormattedConstraint(mockRepo, igSettings, constraint, linkContainedTemplate: linkContainedTemplate, linkIsBookmark: false); string constraintText = target.GetPlainText(); Assert.AreEqual("SHALL contain exactly one [1..1] code=\"1234-X\" Test Disp with @xsi:type=\"CD\", where the code SHALL be selected from CodeSystem SNOMED CT (6.96) (CONF:1-9).", constraintText); }
public void GetPlainText_ConformanceValueCodeSystemTest1() { // Test 1006 TemplateConstraint constraint = mockRepo.TemplateConstraints.Single(y => y.Id == 7); IGSettingsManager igSettings = new IGSettingsManager(this.mockRepo, constraint.Template.OwningImplementationGuideId); IFormattedConstraint target = FormattedConstraintFactory.NewFormattedConstraint(mockRepo, igSettings, igTypePlugin, constraint, linkContainedTemplate: linkContainedTemplate); string constraintText = target.GetPlainText(); Assert.AreEqual("SHALL contain exactly one [1..1] statusCode=\"completed\" Completed (CodeSystem: HL7ActStatus 113883.5.14) (CONF:1-7).", constraintText); }
private void PopulateBinding(TemplateConstraint constraint, Coding coding) { if (coding != null) { constraint.Value = coding.Code; constraint.DisplayName = coding.Display; // TODO: Handle coding.System } }
public void GetPlainText_ConformanceValueCodeSystemTest2() { // Test 1007 TemplateConstraint constraint = mockRepo.TemplateConstraints.Single(y => y.Id == 8); IGSettingsManager igSettings = new IGSettingsManager(this.mockRepo, constraint.Template.OwningImplementationGuideId); IFormattedConstraint target = FormattedConstraintFactory.NewFormattedConstraint(mockRepo, igSettings, igTypePlugin, constraint, linkContainedTemplate: linkContainedTemplate); string constraintText = target.GetPlainText(); Assert.AreEqual("SHALL contain exactly one [1..1] code/@code=\"1234-X\" Test Disp, which SHALL be selected from CodeSystem SNOMED CT (6.96) (CONF:1-8).", constraintText); }
public void TestFormattedConstraint_ContainedTemplate2() { TemplateConstraint ctConstraint = this.mockRepo.TemplateConstraints.Last(y => y.ContainedTemplateId != null); IGSettingsManager igSettings = new IGSettingsManager(this.mockRepo, ctConstraint.Template.OwningImplementationGuideId); IFormattedConstraint fc = FormattedConstraintFactory.NewFormattedConstraint(mockRepo, igSettings, ctConstraint); string constraintText = fc.GetPlainText(); Assert.IsNotNull(constraintText); Assert.AreEqual("This entry SHALL contain exactly one [1..1] Test Template 2 (identifier: 1.2.3.4.5.6) (CONF:1-9).", constraintText); }
private void AddTemplateConstraint(TemplateConstraint constraint, int level, bool aCreateLinksForValueSets, bool includeNotes) { // Skip the child constraints if this is a choice there is only one child constraint. This constraint // adopts the constraint narrative of the child constraint when there is only one option. if (constraint.IsChoice && constraint.ChildConstraints.Count == 1) { constraint = constraint.ChildConstraints.First(); } // TODO: May be able to make this more efficient List <TemplateConstraint> childConstraints = this.AllConstraints .Where(y => y.ParentConstraintId == constraint.Id) .OrderBy(y => y.Order) .ToList(); this.templateConstraintCount++; // All contained template references must exist in the list of templates being exported to be linked // TODO: Improve so that not all references have to be in the export for some to be linked var containedTemplateReferences = constraint.References.Where(y => y.ReferenceType == ConstraintReferenceTypes.Template); var containedTemplatesFound = (from ct in containedTemplateReferences join t in this.AllTemplates on ct.ReferenceIdentifier equals t.Oid select t); bool containedTemplateLinked = containedTemplateReferences.Count() > 0 && containedTemplateReferences.Count() == containedTemplatesFound.Count(); bool includeCategory = this.IncludeCategory && (!this.HasSelectedCategories || this.SelectedCategories.Count > 1); IFormattedConstraint fConstraint = FormattedConstraintFactory.NewFormattedConstraint(this.DataSource, this.IGSettings, this.IGTypePlugin, constraint, this.ConstraintReferences, linkContainedTemplate: containedTemplateLinked, linkIsBookmark: true, createLinksForValueSets: aCreateLinksForValueSets, includeCategory: includeCategory); Paragraph para = fConstraint.AddToDocParagraph(this.MainPart, this.HyperlinkTracker, this.DocumentBody, level - 1, GenerationConstants.BASE_TEMPLATE_INDEX + (int)this.CurrentTemplate.Id, this.ConstraintHeadingStyle); if (!string.IsNullOrEmpty(constraint.Notes) && includeNotes) { this.CommentManager.AddCommentRange(para, constraint.Notes); } // Add child constraints foreach (TemplateConstraint cConstraint in childConstraints) { if (this.HasSelectedCategories && !cConstraint.CategoryIsMatch(this.SelectedCategories)) { continue; } this.AddTemplateConstraint(cConstraint, level + 1, aCreateLinksForValueSets, includeNotes); } // Add samples for the constraint if it is a heading and the settings indicate to include samples if (constraint.IsHeading && this.IncludeSamples) { foreach (var cSample in constraint.Samples) { this.Figures.AddSample(cSample.Name, cSample.SampleText); } } }
/// <summary> /// Returns first branch occurrence of IsBranch (if aConstraint is branch then returns aConstraint) /// </summary> /// <param name="aConstraint"></param> /// <returns></returns> internal TemplateConstraint GetBranch(TemplateConstraint aConstraint) { TemplateConstraint current = aConstraint; while ((current.Parent != null) && (!current.IsBranch)) { current = current.ParentConstraint; } return(current); }
/// <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); }
private void UpdateConstraintBinding(TemplateConstraint constraint, ImportConstraint importConstraint) { if (importConstraint.Item is ImportSingleValueCode) { ImportSingleValueCode importSvc = importConstraint.Item as ImportSingleValueCode; if (constraint.Value != importSvc.code) { constraint.Value = importSvc.code; } if (constraint.DisplayName != importSvc.displayName) { constraint.DisplayName = importSvc.displayName; } } else if (importConstraint.Item is ImportValueSet) { ImportValueSet importVs = importConstraint.Item as ImportValueSet; if (AreBooleansDifferent(constraint.IsStatic, importVs.isStatic, importVs.isStaticSpecified)) { constraint.IsStatic = importVs.isStatic; } // Old bug in Trifolia allowing the same value set identifier to be used more than once var foundValueSets = this.tdb.ValueSets.Where(y => y.Oid.ToLower() == importVs.identifier.ToLower()).ToList(); if (foundValueSets.Count == 0) { var newValueSet = new ValueSet() { Oid = importVs.identifier, Name = string.IsNullOrEmpty(importVs.name) ? importVs.identifier + " incomplete" : importVs.name, IsIncomplete = true, Description = "Automatically generated by template import", LastUpdate = DateTime.Now }; this.tdb.ValueSets.AddObject(newValueSet); foundValueSets.Add(newValueSet); } if (constraint.ValueSet != null && foundValueSets.Contains(constraint.ValueSet)) { return; } if (constraint.ValueSet != foundValueSets.First()) { constraint.ValueSet = foundValueSets.First(); } } }
private attribute ExportAttribute(TemplateConstraint constraint) { IFormattedConstraint formattedConstraint = FormattedConstraintFactory.NewFormattedConstraint(this.tdb, this.igSettings, constraint, null, null, false, false, false, false); attribute constraintAttribute = new attribute(); constraintAttribute.name = constraint.Context.Substring(1); constraintAttribute.isOptional = constraint.Conformance != "SHALL"; constraintAttribute.Items = this.ExportConstraints(constraint, true); return(constraintAttribute); }
public void TestFormattedConstraint_ContainedTemplate2() { TemplateConstraint ctConstraint = this.mockRepo.TemplateConstraints.Last(y => y.References.Any(x => x.ReferenceType == ConstraintReferenceTypes.Template)); IGSettingsManager igSettings = new IGSettingsManager(this.mockRepo, ctConstraint.Template.OwningImplementationGuideId); IIGTypePlugin igTypePlugin = ctConstraint.Template.OwningImplementationGuide.ImplementationGuideType.GetPlugin(); IFormattedConstraint fc = FormattedConstraintFactory.NewFormattedConstraint(mockRepo, igSettings, igTypePlugin, ctConstraint); string constraintText = fc.GetPlainText(); Assert.IsNotNull(constraintText); Assert.AreEqual("This entry SHALL contain exactly one [1..1] Test Template 2 (identifier: 1.2.3.4.5.6) (CONF:1-13).", constraintText); }
/// <summary> /// Uses forward algorithm to go from this constraint forward through the tree /// </summary> /// <param name="aTemplate"></param> /// <param name="aTemplateConstraint"></param> /// <returns></returns> public static string CreateFullBranchedParentContext(string aPrefix, Template aTemplate, TemplateConstraint aTemplateConstraint) { TemplateConstraint current = aTemplateConstraint; var igTypePlugin = aTemplate.ImplementationGuideType.GetPlugin(); string templateContext = TemplateContextBuilder.BuildContextString( aPrefix, igTypePlugin.TemplateIdentifierXpath, igTypePlugin.TemplateVersionIdentifierXpath, aTemplate) + "/"; return(templateContext + CreateFullBranchedParentContext(aPrefix, aTemplateConstraint, isTarget: true)); }
public void GetPlainText_ConformanceValueSetVersionTest() { // Test 1005 TemplateConstraint constraint = mockRepo.TemplateConstraints.Single(y => y.Id == 6); constraint.Context = "administrativeGenderCode"; constraint.ValueSetDate = new DateTime(2012, 5, 1); IGSettingsManager igSettings = new IGSettingsManager(this.mockRepo, constraint.Template.OwningImplementationGuideId); IFormattedConstraint target = FormattedConstraintFactory.NewFormattedConstraint(mockRepo, igSettings, igTypePlugin, constraint, linkContainedTemplate: linkContainedTemplate, linkIsBookmark: false); string constraintText = target.GetPlainText(); Assert.AreEqual("SHALL contain exactly one [1..1] administrativeGenderCode, which MAY be selected from ValueSet GenderCode 11.1 2012-05-01 (CONF:1-6).", constraintText); }
public static bool IsNotBranchIdentifierOrIsValidIdentifier(this TemplateConstraint constraint) { if (!constraint.IsBranchIdentifier) { return(true); } if (!string.IsNullOrEmpty(constraint.Schematron)) { return(false); } return(true); }
private bool IsOptionalParent(TemplateConstraint aConstraint) { TemplateConstraint current = aConstraint; while (current != null) { if (current.BusinessConformanceType != Conformance.SHALL && current.BusinessConformanceType != Conformance.SHALL_NOT) { return(true); } current = current.ParentConstraint; } return(false); }
private bool IsBranchedParent(TemplateConstraint aConstraint) { TemplateConstraint current = aConstraint; while (current.Parent != null) { current = current.ParentConstraint; if (current.IsBranch) { return(true); } } return(false); }
public static bool HasOptionalParent(this TemplateConstraint constraint) { TemplateConstraint current = constraint; while (current != null) { if (current.IsOptionalConformance()) { return(true); } current = current.ParentConstraint; } return(false); }
public Constraint(TemplateConstraint dbConstraint) : this() { this.ConstraintDescription = dbConstraint.Description; this.ConstraintLabel = dbConstraint.Label; this.HeadingDescription = dbConstraint.HeadingDescription; this.Id = dbConstraint.Id; this.IsHeading = dbConstraint.IsHeading; this.IsPrimitive = dbConstraint.IsPrimitive; this.PrimitiveText = dbConstraint.PrimitiveText; this.TemplateId = dbConstraint.TemplateId; this.Context = dbConstraint.Context; this.Conformance = dbConstraint.Conformance; this.Cardinality = dbConstraint.Cardinality; this.Value = dbConstraint.Value; }
private bool IsBranchDescendent(TemplateConstraint aConstraint) { var current = aConstraint; //note this checks parent, which means if aConstraint is a branch this returns false (as it is not a branch descendent but a branch root) while (current.ParentConstraint != null) { current = current.ParentConstraint; if (current.IsBranch) { return(true); } } return(false); }
public static bool HasParentBranch(this TemplateConstraint constraint) { IConstraint parent = constraint.Parent; while (parent != null) { if (parent.IsBranch) { return(true); } parent = parent.Parent; } return(false); }
public void GetImplementationGuideVocabulary_NoStaticValuesets() { Template t = this.tdb.GenerateTemplate("1.2.3.4.5", "Document", "Test Template 1", this.ig); TemplateConstraint tc = this.tdb.GenerateConstraint(t, null, null, "code", "SHALL", "1..1", valueConformance: "SHALL", valueSet: this.vs1); tc.IsStatic = false; VocabService service = new VocabService(this.tdb); string vocXml = service.GetImplementationGuideVocabulary(ig.Id, 0, 1, "UTF-8"); XmlDocument doc = new XmlDocument(); doc.LoadXml(vocXml); Assert.AreEqual("systems", doc.DocumentElement.LocalName); Assert.AreEqual(0, doc.DocumentElement.ChildNodes.Count); }
private bool HasRequiredElement(TemplateConstraint aConstraint) { TemplateConstraint current = aConstraint; while (current != null) { if ((current.BusinessConformanceType == Conformance.SHOULD || current.BusinessConformanceType == Conformance.SHOULD_NOT) || (current.BusinessConformanceType == Conformance.SHALL || current.BusinessConformanceType == Conformance.SHALL_NOT)) { return(true); } current = current.ParentConstraint; } return(false); }
private void SetConstraintStringValue(TemplateConstraint constraint, string propertyName, string value) { System.Reflection.PropertyInfo property = constraint.GetType().GetProperty(propertyName); if (!string.IsNullOrEmpty(value)) { if (value == "<REMOVE>") { property.SetValue(constraint, null); } else { property.SetValue(constraint, value); } } }
/// <summary> /// Removes constraints from the database context /// </summary> private void RemoveConstraints(IObjectRepository tdb, List <ConstraintModel> constraintModels) { foreach (var constraintModel in constraintModels) { if (constraintModel.IsNew) { continue; } TemplateConstraint constraint = tdb.TemplateConstraints.Single(y => y.Id == constraintModel.Id); tdb.TemplateConstraints.Remove(constraint); // Recursively remove child constraints this.RemoveConstraints(tdb, constraintModel.Children); } }
/// <summary> /// Gets the lower and upper bounds of a constraint to be used by XSD element's MinOccurs and MaxOccurs values. /// If the green constraint is not collapsing canonical constraints, it simply returns the cardinality defined /// by the canonical constraint. If it *is* collapsing one or more canonical constraints, it finds /// the maximum possible bounds of the constraints that it is collapsing. /// </summary> /// <param name="greenConstraint">The green constraint whose bounds should be determined.</param> /// <param name="lowerBound">Out parameter that is set to the maximum available lower bound of the constraint</param> /// <param name="upperBound">Out parameter that is set to the maximum available upper bound of the constraint</param> private void GetConstraintBounds(GreenConstraint greenConstraint, out string lowerBound, out string upperBound) { int maxLowerBound = greenConstraint.TemplateConstraint.CardinalityType.Left; int maxUpperBound = greenConstraint.TemplateConstraint.CardinalityType.Right; int?templateParentConstrantId = greenConstraint.TemplateConstraint.ParentConstraintId; int?greenParentConstraintId = greenConstraint.ParentGreenConstraint != null ? (int?)greenConstraint.ParentGreenConstraint.TemplateConstraintId : null; // If we are collapsing some elements... if (templateParentConstrantId != greenParentConstraintId) { TemplateConstraint current = greenConstraint.TemplateConstraint.ParentConstraint; while (current != null && current.Id != greenParentConstraintId) { if (current.CardinalityType.Left > maxLowerBound) { maxLowerBound = current.CardinalityType.Left; } if (current.CardinalityType.Right > maxUpperBound) { maxUpperBound = current.CardinalityType.Right; } current = current.ParentConstraint; } } if (maxLowerBound == int.MaxValue) { lowerBound = "unbounded"; } else { lowerBound = maxLowerBound.ToString(); } if (maxUpperBound == int.MaxValue) { upperBound = "unbounded"; } else { upperBound = maxUpperBound.ToString(); } }
private void CreateTemplate(GreenTemplate greenTemplate) { // Create the xsl:template for the green template and add it to the document string name = Helper.NormalizeName(greenTemplate.Name); XmlElement templateElement = TransformHelper.CreateXslTemplate(this.transformDoc, name, Helper.NormalizeName(greenTemplate.Name)); this.transformDoc.DocumentElement.AppendChild(templateElement); // Identify all the root-level constraints within the template List <TemplateConstraint> rootTemplateConstraints = (from tc in tdb.TemplateConstraints where tc.TemplateId == greenTemplate.TemplateId && tc.ParentConstraintId == null select tc).ToList(); if (!string.IsNullOrEmpty(greenTemplate.Template.TemplateType.RootContext)) { // Create top-level context element XmlElement contextElement = this.transformDoc.CreateElement(TransformHelper.IgNamespacePrefix, greenTemplate.Template.TemplateType.RootContext, this.schemaNamespace); templateElement.AppendChild(contextElement); // TODO: This should be replaced with more generic code for IG types in the future // TODO: This should be put in the right location in the output. If there is an ID constraint, the order of elements won't match CDA.xsd TemplateConstraint foundTemplateId = (from tc in rootTemplateConstraints join tcc in tdb.TemplateConstraints on tc.Id equals tcc.ParentConstraintId where tc.Context == "templateId" && tcc.Context == "@root" && tcc.Value == greenTemplate.Template.Oid select tc).FirstOrDefault(); // If a templateId constraint has not been defined at the top level for this template, then we should create // a templateId element for it, and add it to the output if (foundTemplateId == null) { XmlElement templateIdElement = this.transformDoc.CreateElement(TransformHelper.IgNamespacePrefix, "templateId", this.schemaNamespace); templateIdElement.Attributes.Append( TransformHelper.CreateXsltAttribute(this.transformDoc, "root", greenTemplate.Template.Oid)); contextElement.AppendChild(templateIdElement); } rootTemplateConstraints.ForEach(y => CreateTemplateConstraint(contextElement, y)); } else { rootTemplateConstraints.ForEach(y => CreateTemplateConstraint(templateElement, y)); } }
public static IFormattedConstraint NewFormattedConstraint( IObjectRepository tdb, IGSettingsManager igSettings, IIGTypePlugin igTypePlugin, TemplateConstraint constraint, List <ConstraintReference> references = null, string templateLinkBase = null, string valueSetLinkBase = null, bool linkContainedTemplate = false, bool linkIsBookmark = false, bool createLinksForValueSets = false, bool includeCategory = true) { if (references == null) { references = (from tcr in tdb.TemplateConstraintReferences join t in tdb.Templates on tcr.ReferenceIdentifier equals t.Oid where tcr.TemplateConstraintId == constraint.Id select new ConstraintReference() { Bookmark = t.Bookmark, Identifier = t.Oid, Name = t.Name, TemplateConstraintId = tcr.TemplateConstraintId }).ToList(); } else { references = references.Where(y => y.TemplateConstraintId == constraint.Id).ToList(); } return(NewFormattedConstraint( tdb, igSettings, igTypePlugin, (IConstraint)constraint, references, templateLinkBase, valueSetLinkBase, linkContainedTemplate, linkIsBookmark, createLinksForValueSets, includeCategory, constraint.ValueSet, constraint.CodeSystem)); }
private static bool IsConstraintRequiredByParent(TemplateConstraint constraint) { if (constraint != null) { if (!string.IsNullOrEmpty(constraint.Conformance) && constraint.Conformance != "SHALL") { return(false); } if (!IsConstraintRequiredByParent(constraint.ParentConstraint)) { return(false); } } return(true); }
public void GetPlainText_CategorizedConstraint() { TemplateConstraint constraint = mockRepo.TemplateConstraints.Single(y => y.Id == 10); // Test WITH categories enabled IGSettingsManager igSettings = new IGSettingsManager(this.mockRepo, constraint.Template.OwningImplementationGuideId); IFormattedConstraint target = FormattedConstraintFactory.NewFormattedConstraint(mockRepo, igSettings, igTypePlugin, constraint, linkContainedTemplate: linkContainedTemplate, linkIsBookmark: false, includeCategory: true); string constraintText = target.GetPlainText(); Assert.AreEqual("[TestCategory] SHALL contain exactly one [1..1] code (CONF:1-10).", constraintText); // Test WITHOUT categories enabled target = FormattedConstraintFactory.NewFormattedConstraint(mockRepo, igSettings, igTypePlugin, constraint, linkContainedTemplate: linkContainedTemplate, includeCategory: false); constraintText = target.GetPlainText(); Assert.AreEqual("SHALL contain exactly one [1..1] code (CONF:1-10).", constraintText); }
private IGSettingsManager GetIGSettings(TemplateConstraint constraint) { if (this.allIgSettings.ContainsKey(constraint.Template.OwningImplementationGuide)) { return(this.allIgSettings[constraint.Template.OwningImplementationGuide]); } if (constraint.Template.OwningImplementationGuideId == 0) { return(null); } IGSettingsManager igSettings = new IGSettingsManager(this.tdb, constraint.Template.OwningImplementationGuide.Id); this.allIgSettings.Add(constraint.Template.OwningImplementationGuide, igSettings); return(igSettings); }