Exemple #1
0
        protected static ITypedElement MakeElementStack(Base instance, SummaryType summary)
        {
            if (summary == SummaryType.False)
            {
                return(instance.ToTypedElement());
            }

            var patchedInstance = (Base)instance.DeepCopy();

            MetaSubsettedAdder.AddSubsetted(patchedInstance, atRoot: true);

            var baseNav = new ScopedNode(patchedInstance.ToTypedElement());

            switch (summary)
            {
            case SummaryType.True:
                return(MaskingNode.ForSummary(baseNav));

            case SummaryType.Text:
                return(MaskingNode.ForText(baseNav));

            case SummaryType.Data:
                return(MaskingNode.ForData(baseNav));

            case SummaryType.Count:
                return(MaskingNode.ForCount(baseNav));

            default:
                return(baseNav);
            }
        }
Exemple #2
0
        public void SummaryText()
        {
            var tpXml    = File.ReadAllText(Path.Combine("TestData", "mask-text.xml"));
            var typeinfo = new PocoStructureDefinitionSummaryProvider().Provide("ValueSet");

            var nav    = new ScopedNode(getXmlNode(tpXml));
            var masker = MaskingNode.ForText(nav);
            var output = masker.ToXml();

            var m = masker.Descendants().ToList();
            var maskedChildren = masker.Descendants().Count();

            Assert.AreEqual(8, maskedChildren);
        }
Exemple #3
0
        protected static ITypedElement MakeElementStack(Base instance, SummaryType summary, string[] elements)
        {
            if (summary == SummaryType.False && elements == null)
            {
                return(instance.ToTypedElement());
            }

            if (elements != null && summary != SummaryType.False)
            {
                throw Error.Argument("elements", "Elements parameter is supported only when summary is SummaryType.False or summary is not specified at all.");
            }

            var patchedInstance = (Base)instance.DeepCopy();

            MetaSubsettedAdder.AddSubsetted(patchedInstance, atRoot: true);

            var baseNav = new ScopedNode(patchedInstance.ToTypedElement());

            switch (summary)
            {
            case SummaryType.True:
                return(MaskingNode.ForSummary(baseNav));

            case SummaryType.Text:
                return(MaskingNode.ForText(baseNav));

            case SummaryType.Data:
                return(MaskingNode.ForData(baseNav));

            case SummaryType.Count:
                return(MaskingNode.ForCount(baseNav));

            case SummaryType.False:
                return(MaskingNode.ForElements(baseNav, elements));

            default:
                return(baseNav);
            }
        }