|
|
|
|
@ -18,8 +18,6 @@
@@ -18,8 +18,6 @@
|
|
|
|
|
|
|
|
|
|
using System; |
|
|
|
|
using System.Collections.Generic; |
|
|
|
|
using System.Reflection; |
|
|
|
|
using System.Xml; |
|
|
|
|
using System.Xml.Linq; |
|
|
|
|
using ICSharpCode.Core; |
|
|
|
|
|
|
|
|
|
@ -27,11 +25,11 @@ namespace ICSharpCode.CodeCoverage
@@ -27,11 +25,11 @@ namespace ICSharpCode.CodeCoverage
|
|
|
|
|
{ |
|
|
|
|
public class CodeCoverageMethod |
|
|
|
|
{ |
|
|
|
|
string name = String.Empty; |
|
|
|
|
string className = String.Empty; |
|
|
|
|
string fullClassName = String.Empty; |
|
|
|
|
string classNamespace = String.Empty; |
|
|
|
|
List<CodeCoverageSequencePoint> sequencePoints = new List<CodeCoverageSequencePoint>(); |
|
|
|
|
readonly string name = String.Empty; |
|
|
|
|
readonly string className = String.Empty; |
|
|
|
|
readonly string fullClassName = String.Empty; |
|
|
|
|
readonly string classNamespace = String.Empty; |
|
|
|
|
readonly List<CodeCoverageSequencePoint> sequencePoints = new List<CodeCoverageSequencePoint>(); |
|
|
|
|
|
|
|
|
|
public CodeCoverageMethod(string name, string className) |
|
|
|
|
{ |
|
|
|
|
@ -111,10 +109,7 @@ namespace ICSharpCode.CodeCoverage
@@ -111,10 +109,7 @@ namespace ICSharpCode.CodeCoverage
|
|
|
|
|
public static string GetRootNamespace(string ns) |
|
|
|
|
{ |
|
|
|
|
int index = ns.IndexOf('.'); |
|
|
|
|
if (index > 0) { |
|
|
|
|
return ns.Substring(0, index); |
|
|
|
|
} |
|
|
|
|
return ns; |
|
|
|
|
return index > 0 ? ns.Substring(0, index) : ns; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public List<CodeCoverageSequencePoint> SequencePoints { |
|
|
|
|
@ -192,10 +187,7 @@ namespace ICSharpCode.CodeCoverage
@@ -192,10 +187,7 @@ namespace ICSharpCode.CodeCoverage
|
|
|
|
|
/// </summary>
|
|
|
|
|
public static string GetFullNamespace(string prefix, string name) |
|
|
|
|
{ |
|
|
|
|
if (prefix.Length > 0) { |
|
|
|
|
return String.Concat(prefix, ".", name); |
|
|
|
|
} |
|
|
|
|
return name; |
|
|
|
|
return prefix.Length > 0 ? String.Concat(prefix, ".", name) : name; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
@ -207,7 +199,7 @@ namespace ICSharpCode.CodeCoverage
@@ -207,7 +199,7 @@ namespace ICSharpCode.CodeCoverage
|
|
|
|
|
/// method will return 'XmlEditor' as one of its strings.
|
|
|
|
|
/// </remarks>
|
|
|
|
|
public static List<string> GetChildNamespaces(List<CodeCoverageMethod> methods, string parentNamespace) { |
|
|
|
|
List<string> items = new List<string>(); |
|
|
|
|
var items = new List<string>(); |
|
|
|
|
foreach (CodeCoverageMethod method in methods) { |
|
|
|
|
string classNamespace = method.ClassNamespace; |
|
|
|
|
string dottedParentNamespace = parentNamespace + "."; |
|
|
|
|
@ -226,10 +218,10 @@ namespace ICSharpCode.CodeCoverage
@@ -226,10 +218,10 @@ namespace ICSharpCode.CodeCoverage
|
|
|
|
|
/// </summary>
|
|
|
|
|
public static List<CodeCoverageMethod> GetAllMethods(List<CodeCoverageMethod> methods, string namespaceStartsWith) |
|
|
|
|
{ |
|
|
|
|
List<CodeCoverageMethod> matchedMethods = new List<CodeCoverageMethod>(); |
|
|
|
|
var matchedMethods = new List<CodeCoverageMethod>(); |
|
|
|
|
namespaceStartsWith += "."; |
|
|
|
|
foreach (CodeCoverageMethod method in methods) { |
|
|
|
|
if ((method.ClassNamespace+".").StartsWith(namespaceStartsWith)) { |
|
|
|
|
if ((method.ClassNamespace + ".").StartsWith(namespaceStartsWith, StringComparison.Ordinal)) { |
|
|
|
|
matchedMethods.Add(method); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
@ -241,7 +233,7 @@ namespace ICSharpCode.CodeCoverage
@@ -241,7 +233,7 @@ namespace ICSharpCode.CodeCoverage
|
|
|
|
|
/// </summary>
|
|
|
|
|
public static List<CodeCoverageMethod> GetMethods(List<CodeCoverageMethod> methods, string ns, string className) |
|
|
|
|
{ |
|
|
|
|
List<CodeCoverageMethod> matchedMethods = new List<CodeCoverageMethod>(); |
|
|
|
|
var matchedMethods = new List<CodeCoverageMethod>(); |
|
|
|
|
foreach (CodeCoverageMethod method in methods) { |
|
|
|
|
if (method.ClassName == className && method.ClassNamespace == ns) { |
|
|
|
|
matchedMethods.Add(method); |
|
|
|
|
@ -252,7 +244,7 @@ namespace ICSharpCode.CodeCoverage
@@ -252,7 +244,7 @@ namespace ICSharpCode.CodeCoverage
|
|
|
|
|
|
|
|
|
|
public static List<string> GetClassNames(List<CodeCoverageMethod> methods, string ns) |
|
|
|
|
{ |
|
|
|
|
List<string> names = new List<string>(); |
|
|
|
|
var names = new List<string>(); |
|
|
|
|
foreach (CodeCoverageMethod method in methods) { |
|
|
|
|
if (method.ClassNamespace == ns && !names.Contains(method.ClassName)) { |
|
|
|
|
names.Add(method.ClassName); |
|
|
|
|
|