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(); }
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 }; }
public HierarchyLoaded(Suite top, ResultsCache results) : base("hierarchy-loaded") { hierarchy = top; specs = top.GetAllSpecs().Select(x => new SpecRecord(x, results)).ToArray(); }
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); }
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; }
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}; }
public SuiteNotFoundException(string suite, Suite top) : base("Unable to find suite '{0}' in {1}".ToFormat(suite, top.Folder)) { }
public SpecDeleted(Suite hierarchy, string id) : base("spec-deleted") { this.hierarchy = hierarchy; this.id = id; }
public void AddChildSuite(Suite newSuite) { suites = suites.Union(new[] {newSuite}).ToArray(); }
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(); }
public SuiteAdded(Suite hierarchy, Suite newSuite) : base("suite-added") { this.hierarchy = hierarchy; path = newSuite.path; }
public void AddChildSuite(Suite newSuite) { _suites.Add(newSuite); }
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(); }