當前位置: 首頁>>代碼示例>>C#>>正文


C# Filter.AddFileExclusionFilters方法代碼示例

本文整理匯總了C#中OpenCover.Framework.Filter.AddFileExclusionFilters方法的典型用法代碼示例。如果您正苦於以下問題:C# Filter.AddFileExclusionFilters方法的具體用法?C# Filter.AddFileExclusionFilters怎麽用?C# Filter.AddFileExclusionFilters使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在OpenCover.Framework.Filter的用法示例。


在下文中一共展示了Filter.AddFileExclusionFilters方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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;
        }
開發者ID:alistair,項目名稱:opencover,代碼行數:29,代碼來源:Program.cs

示例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;
        }
開發者ID:tatajjj,項目名稱:opencover,代碼行數:42,代碼來源:Program.cs

示例3: File_Is_Excluded_If_Matches_Filter

        public void File_Is_Excluded_If_Matches_Filter()
        {
            var filter = new Filter();
            filter.AddFileExclusionFilters(new[] { "XXX.*" });

            Assert.IsTrue(filter.ExcludeByFile("XXX.cs"));
        }
開發者ID:alistair,項目名稱:opencover,代碼行數:7,代碼來源:FilterTests.cs

示例4: File_Is_Not_Excluded_If_Does_Not_Match_Filter

        public void File_Is_Not_Excluded_If_Does_Not_Match_Filter()
        {
            var filter = new Filter();
            filter.AddFileExclusionFilters(new[]{"XXX.*"});

            Assert.IsFalse(filter.ExcludeByFile("YYY.cs"));
        }
開發者ID:alistair,項目名稱:opencover,代碼行數:7,代碼來源:FilterTests.cs

示例5: AddFileExclusionFilters_Escapes_Elements_And_Matches

        public void AddFileExclusionFilters_Escapes_Elements_And_Matches()
        {
            var filter = new Filter();

            filter.AddFileExclusionFilters(new[] { ".*" });

            Assert.IsTrue(filter.ExcludedFiles[0].Value.Match(".ABC").Success);
        }
開發者ID:alistair,項目名稱:opencover,代碼行數:8,代碼來源:FilterTests.cs

示例6: AddFileExclusionFilters_Handles_Null_Elements

        public void AddFileExclusionFilters_Handles_Null_Elements()
        {
            var filter = new Filter();

            filter.AddFileExclusionFilters(new[] { null, "" });

            Assert.AreEqual(1, filter.ExcludedFiles.Count);
        }
開發者ID:alistair,項目名稱:opencover,代碼行數:8,代碼來源:FilterTests.cs

示例7: AddFileExclusionFilters_HandlesNull

        public void AddFileExclusionFilters_HandlesNull()
        {
            var filter = new Filter();

            filter.AddFileExclusionFilters(null);

            Assert.AreEqual(0, filter.ExcludedFiles.Count);
        }
開發者ID:alistair,項目名稱:opencover,代碼行數:8,代碼來源:FilterTests.cs

示例8: 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;
        }
開發者ID:stanhuff,項目名稱:opencover,代碼行數:45,代碼來源:Filter.cs

示例9: File_Is_Excluded_If_Matches_Filter_UsingRegularExpressions

        public void File_Is_Excluded_If_Matches_Filter_UsingRegularExpressions()
        {
            // arrange
            var filter = new Filter(true);
            filter.AddFileExclusionFilters(new[] { @"XXX\..*" });

            // act, assert
            Assert.IsTrue(filter.ExcludeByFile("XXX.cs"));
        }
開發者ID:AtwooTM,項目名稱:opencover,代碼行數:9,代碼來源:FilterTests.cs

示例10: AddFileExclustionFilters_DoesNotWrap_ForRegexFilters

        public void AddFileExclustionFilters_DoesNotWrap_ForRegexFilters()
        {
            var filter = new Filter(true);
            const string stringToMatch = "some string on the line before EXPRESSION some string after the expression";

            filter.AddFileExclusionFilters(new[] { "EXPRESSION" });

            var excludedFileRegexFilter = filter.ExcludedFiles[0];
            Assert.IsTrue(excludedFileRegexFilter.IsMatchingExpression(stringToMatch));
        }
開發者ID:AtwooTM,項目名稱:opencover,代碼行數:10,代碼來源:FilterTests.cs

示例11: AddFileExclusionFilters_Escapes_Elements_And_Matches

        public void AddFileExclusionFilters_Escapes_Elements_And_Matches()
        {
            var filter = new Filter(false);

            filter.AddFileExclusionFilters(new[] { ".*" });

            Assert.IsTrue(filter.ExcludedFiles[0].IsMatchingExpression(".ABC"));
        }
開發者ID:AtwooTM,項目名稱:opencover,代碼行數:8,代碼來源:FilterTests.cs


注:本文中的OpenCover.Framework.Filter.AddFileExclusionFilters方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。