예제 #1
0
        public IEnumerable<Specification> Filter(Suite top)
        {
            IEnumerable<Specification> specs;
            if (Suite.IsNotEmpty())
            {
                var suite = top.suites.FirstOrDefault(x => x.name == Suite);
                if (suite == null)
                    throw new SuiteNotFoundException(Suite, top);

                specs = suite.GetAllSpecs();
            }
            else
            {
                specs = top.GetAllSpecs();
            }

            if (Lifecycle != Lifecycle.Any)
            {
                specs = specs.Where(x => x.Lifecycle == Lifecycle);
            }

            var tags = Tags ?? new string[0];
            if (tags.Any())
            {
                specs = specs.Where(spec => tags.All(tag => !spec.Tags.Contains(tag)));
            }

            return specs.ToArray();
        }
예제 #2
0
        public IEnumerable<Specification> Filter(Suite top)
        {
            if (Lifecycle == Lifecycle.Any && Suite.IsEmpty()) return top.GetAllSpecs();

            IEnumerable<Specification> specs;

            if (Suite.IsNotEmpty())
            {
                var suite = top.suites.FirstOrDefault(x => x.name == Suite);
                if (suite == null)
                    throw new SuiteNotFoundException(Suite, top);

                specs = suite.GetAllSpecs();
            }
            else
            {
                specs = top.GetAllSpecs();
            }

            if (Lifecycle != Lifecycle.Any)
            {
                specs = specs.Where(x => x.Lifecycle == Lifecycle);
            }

            return specs.ToArray();
        }
        public void SetUp()
        {
            childSuite1 = new Suite
            {
                name = "Child Suite 1",
                suites = new Suite[0],
                Specifications = new[]
                {
                    new Specification { name = "Spec 1a", Lifecycle = Lifecycle.Acceptance, Tags = { "tag1", "tag2" }},
                    new Specification { name = "Spec 1b", Lifecycle = Lifecycle.Regression, Tags = { "tag2" } }
                }
            };

            childSuite2 = new Suite
            {
                name = "Child Suite 2",
                suites = new Suite[0],
                Specifications = new[]
                {
                    new Specification { name = "Spec 2a", Lifecycle = Lifecycle.Acceptance, Tags = { "tag1", "tag2", "tag3" } },
                    new Specification { name = "Spec 2b", Lifecycle = Lifecycle.Regression, Tags = { "tag4" } }
                }
            };

            theTopSuite = new Suite
            {
                Specifications = new Specification[0],
                suites = new[]
                {
                    childSuite1, childSuite2
                }
            };

            theRequest = new BatchRunRequest { Lifecycle = Lifecycle.Any };
        }
예제 #4
0
        public HierarchyLoaded(Suite top, ResultsCache results)
            : base("hierarchy-loaded")
        {
            hierarchy = top;

            specs = top.GetAllSpecs().Select(x => new SpecRecord(x, results)).ToArray();
        }
예제 #5
0
        private static void writeInitialData(HtmlDocument document, Suite top, FixtureLibrary fixtures, string title)
        {
            ClientMessage[] initial = new ClientMessage[]
            {
                new FixturesReloaded {fixtures = fixtures.Models.ToArray()},
                new HierarchyLoaded(top, new ResultsCache()),
                new ProjectTitle(title),
            };

            var cleanJson = JsonSerialization.ToCleanJson(initial);
            document.Body.Add("div").Hide().Id("spec-data").Text(cleanJson);
        }
예제 #6
0
        public static Suite ReadSuite(string folder)
        {
            var suite = new Suite
            {
                name = Path.GetFileName(folder),
                Specifications =
                    FileSystem.FindFiles(folder, FileSet.Shallow("*.md")).Select(MarkdownReader.ReadFromFile).ToArray(),
                Folder = folder
            };

            foreach (var directory in FileSystem.ChildDirectoriesFor(folder))
            {
                suite.AddChildSuite(ReadSuite(directory));
            }

            return suite;
        }
예제 #7
0
        public static HtmlDocument Build(Suite top, FixtureLibrary fixtures, string title)
        {
            var document = new HtmlDocument
            {
                Title = title
            };

            BatchResultsWriter.WriteCSS(document);

            writeInitialData(document, top, fixtures, title);

#if DEBUG
            HomeEndpoint.WriteClientAssetsDebugMode(document, false, "/preview.js");
#else
            writeEnbeddedJavascript(document);
#endif

            document.Body.Add("div").Id("main");

            return document;
        }
        public BatchRunRequestTester()
        {
            childSuite1 = new Suite
            {
                name = "Child Suite 1",
                Specifications = new[]
                {
                    new Specification {name = "Spec 1a", Lifecycle = Lifecycle.Acceptance, Tags = {"tag1", "tag2"}},
                    new Specification {name = "Spec 1b", Lifecycle = Lifecycle.Regression, Tags = {"tag2"}}
                }
            };

            childSuite2 = new Suite
            {
                name = "Child Suite 2",
                Specifications = new[]
                {
                    new Specification
                    {
                        name = "Spec 2a",
                        Lifecycle = Lifecycle.Acceptance,
                        Tags = {"tag1", "tag2", "tag3"}
                    },
                    new Specification {name = "Spec 2b", Lifecycle = Lifecycle.Regression, Tags = {"tag4"}}
                }
            };

            theTopSuite = new Suite
            {
                Specifications = new Specification[0]
            };

            theTopSuite.AddChildSuite(childSuite1);
            theTopSuite.AddChildSuite(childSuite2);

            theRequest = new BatchRunRequest {Lifecycle = Lifecycle.Any};
        }
예제 #9
0
 public SuiteNotFoundException(string suite, Suite top)
     : base("Unable to find suite '{0}' in {1}".ToFormat(suite, top.Folder)) { }
예제 #10
0
 public SpecDeleted(Suite hierarchy, string id)
     : base("spec-deleted")
 {
     this.hierarchy = hierarchy;
     this.id = id;
 }
예제 #11
0
 public void AddChildSuite(Suite newSuite)
 {
     suites = suites.Union(new[] {newSuite}).ToArray();
 }
예제 #12
0
 public SuiteAdded(Suite hierarchy)
     : base("suite-added")
 {
     this.hierarchy = hierarchy;
 }
 public integration_tests_with_the_grammar_project()
 {
     _hierarchy = HierarchyLoader.ReadHierarchy(_folder);
     _allSpecs = _hierarchy.GetAllSpecs().ToArray();
 }
예제 #14
0
 public SuiteAdded(Suite hierarchy, Suite newSuite) : base("suite-added")
 {
     this.hierarchy = hierarchy;
     path = newSuite.path;
 }
예제 #15
0
 public void AddChildSuite(Suite newSuite)
 {
     _suites.Add(newSuite);
 }
예제 #16
0
 public SpecAdded(Suite hierarchy, Specification data)
     : base("spec-added")
 {
     this.hierarchy = hierarchy;
     this.data = data;
 }
 public void SetUp()
 {
     _hierarchy = HierarchyLoader.ReadHierarchy(_folder);
     _allSpecs = _hierarchy.GetAllSpecs().ToArray();
 }