示例#1
0
 public void GivenTheTestcasesAreGeneratedFrom(string statName, string statValue, string statDesc)
 {
     var testCase = new TestCaseExtension {StatName = statName, StatVal = statValue, StatDesc = statDesc};
     ScenarioContext.Current.Set(testCase, "testCase");
 }
示例#2
0
        public static void SetTestCase(ref XmlDocument doc, string xpath, TestCaseExtension testCase)
        {
            XmlNodeList testCases;
            try
            {
                testCases = doc.SelectNodes(xpath, NamespaceMgr);
            }
            catch (XPathException)
            {
                return;
            }

            foreach (XmlNode testcase in testCases)
            {
                if (testcase.Attributes == null) continue;
                var name = testcase.Attributes["id"].Value.Replace("#test.", "");

                var valueNode = testcase.SelectSingleNode("rst:value", NamespaceMgr);
                var descNode = testcase.SelectSingleNode("rst:description", NamespaceMgr);
                if (valueNode == null || descNode == null) continue;
                valueNode = valueNode.LastChild;
                descNode = descNode.LastChild;
                if (valueNode == null || descNode == null) continue;

                if (testCase.StatName != name) continue;
                valueNode.Value = testCase.StatVal;
                descNode.Value = testCase.StatDesc;
            }
        }