Пример #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);
            }
        }
Пример #2
0
        public void SummaryData()
        {
            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.ForData(nav);
            var output = masker.ToXml();

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

            Assert.AreEqual(nav.Descendants().Count() - 3, maskedChildren);
        }
Пример #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);
            }
        }