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 static List <Specification> Filter(Suite top, Lifecycle lifecycle = Lifecycle.Any, string suiteOrSpec = "", string[] includeTags = default(string[]), string[] excludeTags = default(string[])) { IEnumerable <Specification> specs; if (suiteOrSpec.IsNotEmpty()) { suiteOrSpec = suiteOrSpec.Replace(" / ", "/"); var suite = top.suites.FirstOrDefault(x => x.name == suiteOrSpec) ?? top.suites.FirstOrDefault(x => x.path == suiteOrSpec); if (suite != null) { specs = suite.GetAllSpecs(); } else { var spec = top.GetAllSpecs().FirstOrDefault(x => x.path == suiteOrSpec); if (spec != null) { return(new List <Specification> { spec }); } else { throw new SuiteOrSpecNotFoundException(suiteOrSpec, top); } } } else { specs = top.GetAllSpecs(); } if (lifecycle != Lifecycle.Any) { specs = specs.Where(x => x.Lifecycle == lifecycle); } if (excludeTags != null && excludeTags.Any()) { specs = specs.Where(spec => excludeTags.All(tag => !spec.Tags.Contains(tag))); } if (includeTags != null && includeTags.Any()) { specs = specs.Where(spec => spec.Tags.Intersect(includeTags).Any()); } return(specs.ToList()); }
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 static List <Specification> Filter(Suite top, Lifecycle lifecycle = Lifecycle.Any, string suiteName = "", string[] tags = default(string[])) { IEnumerable <Specification> specs; if (suiteName.IsNotEmpty()) { var suite = top.suites.FirstOrDefault(x => x.name == suiteName); if (suite == null) { throw new SuiteNotFoundException(suiteName, top); } specs = suite.GetAllSpecs(); } else { specs = top.GetAllSpecs(); } if (lifecycle != Lifecycle.Any) { specs = specs.Where(x => x.Lifecycle == lifecycle); } if (tags != null && tags.Any()) { specs = specs.Where(spec => tags.All(tag => !spec.Tags.Contains(tag))); } return(specs.ToList()); }
public HierarchyLoaded(Suite top, ResultsCache results) : base("hierarchy-loaded") { hierarchy = top; specs = top.GetAllSpecs().Select(x => new SpecRecord(x, results)).ToArray(); }
public integration_tests_with_the_grammar_project() { _hierarchy = HierarchyLoader.ReadHierarchy(_folder); _allSpecs = _hierarchy.GetAllSpecs().ToArray(); }
public void SetUp() { _hierarchy = HierarchyLoader.ReadHierarchy(_folder); _allSpecs = _hierarchy.GetAllSpecs().ToArray(); }