本文整理汇总了C#中OpenCover.Framework.Filter.AddTestFileFilters方法的典型用法代码示例。如果您正苦于以下问题:C# Filter.AddTestFileFilters方法的具体用法?C# Filter.AddTestFileFilters怎么用?C# Filter.AddTestFileFilters使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OpenCover.Framework.Filter
的用法示例。
在下文中一共展示了Filter.AddTestFileFilters方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BuildFilter
private static IFilter BuildFilter(CommandLineParser parser)
{
var filter = new Filter();
// apply filters
if (!parser.NoDefaultFilters)
{
filter.AddFilter("-[mscorlib]*");
filter.AddFilter("-[mscorlib.*]*");
filter.AddFilter("-[System]*");
filter.AddFilter("-[System.*]*");
filter.AddFilter("-[Microsoft.VisualBasic]*");
}
if (parser.Filters.Count == 0)
{
filter.AddFilter("+[*]*");
}
else
{
parser.Filters.ForEach(filter.AddFilter);
}
filter.AddAttributeExclusionFilters(parser.AttributeExclusionFilters.ToArray());
filter.AddFileExclusionFilters(parser.FileExclusionFilters.ToArray());
filter.AddTestFileFilters(parser.TestFilters.ToArray());
return filter;
}
示例2: BuildFilter
private static IFilter BuildFilter(CommandLineParser parser)
{
var filter = new Filter();
// apply filters
if (!parser.NoDefaultFilters)
{
filter.AddFilter("-[mscorlib]*");
filter.AddFilter("-[mscorlib.*]*");
filter.AddFilter("-[System]*");
filter.AddFilter("-[System.*]*");
filter.AddFilter("-[Microsoft.VisualBasic]*");
}
if (parser.Filters.Count == 0 && string.IsNullOrEmpty(parser.FilterFile))
{
filter.AddFilter("+[*]*");
}
else
{
if (!string.IsNullOrEmpty(parser.FilterFile))
{
if (!File.Exists(parser.FilterFile))
System.Console.WriteLine("FilterFile '{0}' cannot be found - have you specified your arguments correctly?", parser.FilterFile);
else
{
var filters = File.ReadAllLines(parser.FilterFile);
filters.ToList().ForEach(filter.AddFilter);
}
}
if (parser.Filters.Count > 0)
{
parser.Filters.ForEach(filter.AddFilter);
}
}
filter.AddAttributeExclusionFilters(parser.AttributeExclusionFilters.ToArray());
filter.AddFileExclusionFilters(parser.FileExclusionFilters.ToArray());
filter.AddTestFileFilters(parser.TestFilters.ToArray());
return filter;
}
示例3: AddTestFileFilters_Escapes_Elements_And_Matches
public void AddTestFileFilters_Escapes_Elements_And_Matches()
{
var filter = new Filter();
filter.AddTestFileFilters(new[] { ".*" });
Assert.IsTrue(filter.TestFiles[0].Value.Match(".ABC").Success);
}
示例4: AddTestFileFilters_Handles_Null_Elements
public void AddTestFileFilters_Handles_Null_Elements()
{
var filter = new Filter();
filter.AddTestFileFilters(new[] { null, "" });
Assert.AreEqual(1, filter.TestFiles.Count);
}
示例5: AssemblyIsIncludedForTestMethodGatheringWhenFilterMatches
public void AssemblyIsIncludedForTestMethodGatheringWhenFilterMatches()
{
var filter = new Filter();
filter.AddTestFileFilters(new []{"A*"});
Assert.IsTrue(filter.UseTestAssembly("ABC.dll"));
Assert.IsFalse(filter.UseTestAssembly("XYZ.dll"));
}
示例6: AddTestFileFilters_HandlesNull
public void AddTestFileFilters_HandlesNull()
{
var filter = new Filter();
filter.AddTestFileFilters(null);
Assert.AreEqual(0, filter.TestFiles.Count);
}
示例7: BuildFilter
/// <summary>
/// Create a filter entity from parser parameters
/// </summary>
/// <param name="parser"></param>
/// <returns></returns>
public static IFilter BuildFilter(CommandLineParser parser)
{
var filter = new Filter(parser.RegExFilters);
// apply filters
if (!parser.NoDefaultFilters)
{
if (parser.RegExFilters)
{
filter.AddFilter(@"-[(mscorlib)](.*)");
filter.AddFilter(@"-[(mscorlib\..*)](.*)");
filter.AddFilter(@"-[(System)](.*)");
filter.AddFilter(@"-[(System\..*)](.*)");
filter.AddFilter(@"-[(Microsoft.VisualBasic)](.*)");
}
else
{
filter.AddFilter("-[mscorlib]*");
filter.AddFilter("-[mscorlib.*]*");
filter.AddFilter("-[System]*");
filter.AddFilter("-[System.*]*");
filter.AddFilter("-[Microsoft.VisualBasic]*");
}
}
if (parser.Filters.Count > 0)
{
parser.Filters.ForEach(filter.AddFilter);
}
filter.AddAttributeExclusionFilters(parser.AttributeExclusionFilters.ToArray());
filter.AddFileExclusionFilters(parser.FileExclusionFilters.ToArray());
filter.AddTestFileFilters(parser.TestFilters.ToArray());
foreach (var excludeDir in parser.ExcludeDirs)
{
filter.AddExcludedFolder(excludeDir);
}
return filter;
}
示例8: AddTestFileFilters_DoesNotWrap_ForRegexFilters
public void AddTestFileFilters_DoesNotWrap_ForRegexFilters()
{
var filter = new Filter(true);
const string stringToMatch = "some string on the line before EXPRESSION some string after the expression";
filter.AddTestFileFilters(new[] { "EXPRESSION" });
var excludedTestFileRegex = filter.TestFiles[0];
Assert.IsTrue(excludedTestFileRegex.IsMatchingExpression(stringToMatch));
}
示例9: AddTestFileFilters_Escapes_Elements_And_Matches
public void AddTestFileFilters_Escapes_Elements_And_Matches()
{
var filter = new Filter(false);
filter.AddTestFileFilters(new[] { ".*" });
Assert.IsTrue(filter.TestFiles[0].IsMatchingExpression(".ABC"));
}