Beispiel #1
0
        public void Build(IEnumerable <string> templates, string[] variables, DataTable dataTable, bool useGrouping, IDictionary <string, object> globalVariables)
        {
            if (templates.Count() == 0)
            {
                throw new ArgumentException("No template was specified. You must at least define a template before generating a test suite.");
            }

            if (templates.Count() == 1)
            {
                Build(templates.ElementAt(0), variables, dataTable, useGrouping, globalVariables);
            }
            else
            {
                var cases = GetCases(dataTable, useGrouping);
                foreach (var indiv in cases)
                {
                    foreach (var template in templates)
                    {
                        var generator = new StringTemplateEngine(template, variables);
                        generator.Progressed += new EventHandler <ProgressEventArgs>(this.OnTestGenerated);
                        lastGeneration        = generator.BuildTests(new List <List <List <object> > >()
                        {
                            indiv
                        }, globalVariables).ToList();
                        generator.Progressed -= new EventHandler <ProgressEventArgs>(this.OnTestGenerated);
                        Tests = Tests.Concat(lastGeneration).ToList();
                    }
                }
            }
        }
Beispiel #2
0
        public void Build(string template, string[] variables, DataTable dataTable, bool useGrouping, IDictionary <string, object> globalVariables)
        {
            var generator = new StringTemplateEngine(template, variables);
            var cases     = GetCases(dataTable, useGrouping);

            generator.Progressed += new EventHandler <ProgressEventArgs>(this.OnTestGenerated);
            lastGeneration        = generator.BuildTests(cases, globalVariables).ToList();
            generator.Progressed -= new EventHandler <ProgressEventArgs>(this.OnTestGenerated);
            Tests = Tests.Concat(lastGeneration).ToList();
        }