コード例 #1
0
ファイル: TestListManager.cs プロジェクト: jeason0813/NBi
        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.Build(new List <List <List <object> > >()
                        {
                            indiv
                        }, globalVariables).ToList();
                        generator.Progressed -= new EventHandler <ProgressEventArgs>(this.OnTestGenerated);
                        Tests = Tests.Concat(lastGeneration).ToList();
                    }
                }
            }
        }
コード例 #2
0
ファイル: TestListManager.cs プロジェクト: jeason0813/NBi
        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.Build(cases, globalVariables).ToList();
            generator.Progressed -= new EventHandler <ProgressEventArgs>(this.OnTestGenerated);
            Tests = Tests.Concat(lastGeneration).ToList();
        }
コード例 #3
0
ファイル: TestListManager.cs プロジェクト: kalyon/NBi
        public void AddCategory(Test test, string categoryName)
        {
            var categories = test.Reference.Categories;

            if (!categories.Contains(categoryName))
            {
                categories.Add(categoryName);
                test.Reference.Content = StringTemplateEngine.XmlSerializeFrom <TestStandaloneXml>((TestStandaloneXml)test.Reference);
            }
        }