private void FindProjectItem(Type declaringType, Project project) { // TODO: Besser suchen (prüfen ob der Type in dem Item enthalten ist oder so) ProjectFileItem = project.GetItems("Compile").FirstOrDefault(item => item.EvaluatedInclude.Contains(declaringType.Name)); if (ProjectFileItem != null && (ProjectFileItem.GetFile().Exists)) { UpdateLineColumnInfo(); } }
private void UpdateLineColumnInfo() { var lines = File.ReadAllLines(ProjectFileItem.GetFile().FullName); var line = lines.FirstOrDefault(s => s.ToLower().Contains(string.Format("public void {0}", TestMethodName).ToLower())); if (!string.IsNullOrEmpty(line)) { Line = lines.IndexOf(line) + 1; if (Line > 1) { Column = line.IndexOf(TestMethodName, StringComparison.InvariantCultureIgnoreCase); } } }