public void AddAffectedSuite(Suite suite) { if (_affectedSuites.Contains(suite)) return; _affectedSuites.Add(suite); }
private Suite PrepareSuiteForReporting(Suite s) { s.Descriptions.ForEach(d => d.ResetCasesForReporting()); return s; }
public IEnumerable<Suite> HandleFiles(IEnumerable<IFile> files) { var affectedSuites = new List<Suite>(); foreach (var file in files) { var isSystem = IsSystem(file); if (isSystem) { var suite = new Suite(file); _suites.Add(suite); } var isDescription = IsDescription(file); if (isDescription && _descriptionComponents.ContainsKey(SystemComponentName)) { var systemComponentIndex = _descriptionComponents[SystemComponentName]; foreach (var suite in _suites) { var match = _descriptionsSearchPathRegex.Match(file.FullPath); if (match.Groups[systemComponentIndex+1].Value == suite.System) { var description = new Description(file); // Todo: Hack for now description.AddCase(new Case()); suite.AddDescription(description); if( !affectedSuites.Contains(suite) ) { affectedSuites.Add (suite); } } } } } return affectedSuites; }
bool IsDescriptionForSystem(Description description, Suite suite) { var systemComponents = _systemsSearchPathRegex.Match(suite.SystemFile.FullPath); var descriptionComponents = _descriptionsSearchPathRegex.Match(description.File.FullPath); for (int i = 0; i < _systemComponents.Count(); i++) { var customComponent = _systemComponents.ElementAt(i); var matchIndex = customComponent.Value + 1; if (systemComponents.Groups.Count >= matchIndex && descriptionComponents.Groups.Count >= matchIndex) if (systemComponents.Groups[matchIndex].Value == descriptionComponents.Groups[matchIndex].Value) continue; return false; } return true; }
public IEnumerable<Suite> HandleFiles(IEnumerable<IFile> files) { var affectedSuites = new List<Suite>(); foreach (var file in files) { var isSystem = IsSystem(file); if (isSystem) { var suite = _suites.Where(s => s.SystemFile.FullPath == file.FullPath).SingleOrDefault(); if (suite == null) { suite = new Suite(file); _suites.Add(suite); } if (!affectedSuites.Contains(suite)) affectedSuites.Add(suite); } var isDescription = IsDescription(file); if (isDescription) { var description = new Description(file); _suites.Where(s => IsDescriptionForSystem(description, s)) .ForEach(s => { s.AddDescription(description); if (!affectedSuites.Contains(s)) affectedSuites.Add(s); }); } } return affectedSuites; }