예제 #1
0
 public NUnitDiscoveryTestCase(BaseProperties theBase, INUnitDiscoveryCanHaveTestCases parent,
                               string className,
                               string methodname, long seed) : base(theBase, parent)
 {
     ClassName  = className;
     MethodName = methodname;
     Seed       = seed;
 }
        public static IEnumerable <NUnitDiscoveryTestCase> ExtractTestCases(INUnitDiscoveryCanHaveTestCases tf, XElement node)
        {
            foreach (var child in node.Elements("test-case"))
            {
                var tc = ExtractTestCase(tf, child);
                tf.AddTestCase(tc);
            }

            return(tf.TestCases);
        }
        /// <summary>
        /// Extracts single test case, made public for testing.
        /// </summary>
        public static NUnitDiscoveryTestCase ExtractTestCase(INUnitDiscoveryCanHaveTestCases tf, XElement child)
        {
            var className  = child.Attribute(NUnitXmlAttributeNames.Classname)?.Value;
            var methodName = child.Attribute(NUnitXmlAttributeNames.Methodname)?.Value;
            var seedAtr    = child.Attribute(NUnitXmlAttributeNames.Seed)?.Value;
            var seed       = seedAtr != null?long.Parse(seedAtr, CultureInfo.InvariantCulture) : 0;

            var btf = ExtractSuiteBasePropertiesClass(child);
            var tc  = new NUnitDiscoveryTestCase(btf, tf, className, methodName, seed);

            return(tc);
        }