private void ProjectNameRegexTextChanged(object sender, TextChangedEventArgs e) { var outcomeTexBox = regExProjectOutcome; Regex regEx; tbProjectSuffixGuidance.Text = string.Format("The configuration below defines that the project name of all " + "test assemblies must match the RegEx '{0}'. Use brackets to extract the associated code project name. " + "The namespace of the project and associated test project must be the same. " , testProjectNameRegExTextBox.Text); try { outcomeTexBox.Text = ""; regEx = new Regex(testProjectNameRegExTextBox.Text); } catch (Exception) { return; } if (regEx.GetGroupNames().Count() < 2) { outcomeTexBox.Text = "RegEx must contain at least one regex group ()."; return; } if (_solution != null) { ResharperHelper.ProtectActionFromReEntry(_lifetime, "TestcopOptionsPage", () => { var testProjects = _solution.GetAllCodeProjects().Select(p => p).Where(p => regEx.IsMatch(p.Name ?? "")).ToList(); outcomeTexBox.Text = testProjects.Any() ? "" : "Warning: the regex does not match the NAME of any loaded projects."; }).Invoke(); } }
public void DumpDebug(ISolution solution) { var rx = TestingRegEx; solution.GetAllCodeProjects().ForEach( p => ResharperHelper.AppendLineToOutputWindow(solution.Locks, "\tProject Namespace:" + p.GetDefaultNamespace() + (rx.IsMatch(p.GetDefaultNamespace() ?? "") ? " matches " : " does not match ") + rx)); }
public void DumpDebug(ISolution solution) { Regex testNameSpaceRegEx = this.TestNameSpaceRegEx; foreach (IProject project in solution.GetAllCodeProjects()) { string projectDefaultNameSpace = project.GetDefaultNamespace(); bool matchesTestNameSpace = testNameSpaceRegEx.IsMatch(projectDefaultNameSpace ?? ""); string matchResult = matchesTestNameSpace ? " matches " : " does not match "; ResharperHelper.AppendLineToOutputWindow(solution.Locks, $"\tProject Namespace:{projectDefaultNameSpace}{matchResult}{testNameSpaceRegEx}"); } }
public static List <IClrDeclaredElement> FindClass(ISolution solution, string classNameToFind) { var codeProjects = solution.GetAllCodeProjects().ToList(); return(FindClass(solution, classNameToFind, codeProjects)); }