Ejemplo n.º 1
0
        /// <summary>
        /// Go through the Test tree, building a tree of TestFixures with Test nodes. 
        /// </summary>
        private void MapTestTreeToFixtures(TreeDictionary<string, TestClosure> source, TestSuite container, Type fixtureType)
        {
            foreach (var testClosure in source.Items) {
                container.Add(new ClosureTest(testClosure));
            }

            foreach (var child in source.Children) {
                var fixture = new TestFixture(fixtureType);
                fixture.TestName.Name = child.Key;
                foreach (var testClosure in child.Value.Items) {
                    fixture.Add(new ClosureTest(testClosure));
                }

                foreach (var sub_child in child.Value.Children) {
                    var sub_fixture = new TestFixture(fixtureType);
                    sub_fixture.TestName.Name = sub_child.Key;
                    MapTestTreeToFixtures(sub_child.Value, sub_fixture, fixtureType);
                    fixture.Add(sub_fixture);
                }
                container.Add(fixture);
            }
        }
Ejemplo n.º 2
0
        protected TestFixture LoadTestScripts(ScriptSuiteDefinition definition)
        {
            var engine = new Engine(definition.LanguageSetup, definition.EnableDebugging);
            engine.Initialise(definition.ScriptContext);

            var tests = new List<Test>();
            IList<string> scripts = definition.FindScripts();

            var testFixture = new TestFixture(definition.GetType());
            foreach (var script in scripts)
            {
                var test = new ScriptTest(script, engine);
                test.Fixture = testFixture;
                testFixture.Add(test);
            }

            return testFixture;
        }