Ejemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="FeatureTestCaseLabel" /> class.
        /// </summary>
        /// <param name="lab">FeatureTestCaseLabel.</param>
        public FeatureTestCaseLabel(FeatureTestCaseLabel lab)
        {
            Features = new Dictionary<string, string>();
            PredictFeatureName = lab.PredictFeatureName;
            PredictFeatureValue = lab.PredictFeatureValue;
            ExpectedFeatureValue = lab.ExpectedFeatureValue;
            DefaultFeatureValue = lab.DefaultFeatureValue;
            Probability = lab.Probability;
            Confidence = lab.Confidence;
            Source = lab.Source;

            if (lab.Features.Count != 0)
            {
                foreach (string k in lab.Features.Keys)
                {
                    Features.Add(k, lab.Features[k]);
                }
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Parse test case element.
        /// </summary>
        /// <param name="caseNode">XML test case node.</param>
        /// <param name="nsmgr">Xml namespace manager.</param>
        public void Parse(XmlNode caseNode, XmlNamespaceManager nsmgr)
        {
            Helper.ThrowIfNull(caseNode);
            Helper.ThrowIfNull(nsmgr);
            XmlNode textNode = caseNode.SelectSingleNode(@"tts:text", nsmgr);
            Helper.ThrowIfNull(textNode);
            Text = textNode.InnerText;
            Id = caseNode.Attributes["id"].InnerText;

            XmlNodeList labelNodeList = caseNode.SelectNodes(@"tts:labels/tts:label", nsmgr);
            foreach (XmlNode labelNode in labelNodeList)
            {
                FeatureTestCaseLabel label = new FeatureTestCaseLabel();
                label.Parse(labelNode, nsmgr);
                Labels.Add(label);
            }
        }