예제 #1
0
        internal static ExperimentStep FromXElement(XElement experimentStepElement)
        {
            ExperimentStep experimentStep = new ExperimentStep();

            //// Import attributes for the implemented interfaces
            experimentStep.ImportISignableItemWithName(experimentStepElement);
            experimentStep.ImportISourceDataLocation(experimentStepElement);

            //// Import all other attributes
            experimentStep.ExperimentStepId = experimentStepElement.Attribute("experimentStepID").Value;
            experimentStep.TemplateUsed     = experimentStepElement.Attribute("templateUsed")?.Value;
            experimentStep.Comment          = experimentStepElement.Attribute("comment")?.Value;

            //// Import the child elements of the current object
            XElement tagSetElement = experimentStepElement.Elements(NamespaceHelper.GetXName("TagSet")).SingleOrDefault();

            if (tagSetElement != null)
            {
                experimentStep.TagSet = TagSet.FromXElement(tagSetElement);
            }

            XElement techniqueElement = experimentStepElement.Elements(NamespaceHelper.GetXName("Technique")).SingleOrDefault();

            if (techniqueElement != null)
            {
                experimentStep.Technique = Technique.FromXElement(techniqueElement);
            }

            XElement infrastructureElement = experimentStepElement.Elements(NamespaceHelper.GetXName("Infrastructure")).SingleOrDefault();

            if (infrastructureElement != null)
            {
                experimentStep.Infrastructure = Infrastructure.FromXElement(infrastructureElement);
            }

            XElement methodElement = experimentStepElement.Elements(NamespaceHelper.GetXName("Method")).SingleOrDefault();

            if (methodElement != null)
            {
                experimentStep.Method = Method.FromXElement(methodElement);
            }

            experimentStep.Results.AddRange(experimentStepElement.Elements(NamespaceHelper.GetXName("Result")).Select(Result.FromXElement));

            return(experimentStep);
        }
예제 #2
0
        internal static Template FromXElement(XElement templateElement)
        {
            Template template = new Template();

            //// Import attributes for the implemented interfaces
            template.ImportISignableItemWithName(templateElement);
            template.ImportISourceDataLocation(templateElement);

            //// Import all other attributes
            template.TemplateId = templateElement.Attribute("templateId").Value;

            //// Import the child elements of the current object
            XElement tagSetElement = templateElement.Element(NamespaceHelper.GetXName("TagSet"));

            if (tagSetElement != null)
            {
                template.TagSet = TagSet.FromXElement(tagSetElement);
            }

            XElement techniqueElement = templateElement.Element(NamespaceHelper.GetXName("Technique"));

            if (techniqueElement != null)
            {
                template.Technique = Technique.FromXElement(techniqueElement);
            }

            XElement infrastructureElement = templateElement.Element(NamespaceHelper.GetXName("Infrastructure"));

            if (infrastructureElement != null)
            {
                template.Infrastructure = Infrastructure.FromXElement(infrastructureElement);
            }

            XElement methodElement = templateElement.Element(NamespaceHelper.GetXName("Method"));

            if (methodElement != null)
            {
                template.Method = Method.FromXElement(methodElement);
            }

            template.Results.AddRange(templateElement.Elements(NamespaceHelper.GetXName("Result")).Select(Result.FromXElement));

            return(template);
        }