当前位置: 首页>>代码示例>>C#>>正文


C# Framework.CommandLineParser类代码示例

本文整理汇总了C#中OpenCover.Framework.CommandLineParser的典型用法代码示例。如果您正苦于以下问题:C# CommandLineParser类的具体用法?C# CommandLineParser怎么用?C# CommandLineParser使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


CommandLineParser类属于OpenCover.Framework命名空间,在下文中一共展示了CommandLineParser类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: ThrowsExceptionWhenArgumentUnrecognised

        public void ThrowsExceptionWhenArgumentUnrecognised()
        {
            // arrange
            var parser = new CommandLineParser(new[]{"-bork"});

            // act
            Assert.Throws<InvalidOperationException>(parser.ExtractAndValidateArguments);

            // assert
        }
开发者ID:AtwooTM,项目名称:opencover,代码行数:10,代码来源:CommandLineParserTests.cs

示例3: ExtractsHideSkipped_DefaultsToAll

        public void ExtractsHideSkipped_DefaultsToAll()
        {
            // arrange
            var parser = new CommandLineParser(new[] { "-hideskipped", RequiredArgs });

            parser.ExtractAndValidateArguments();

            // assert
            Assert.AreEqual(5, parser.HideSkipped.Distinct().Count());
        }
开发者ID:nagyist,项目名称:sawilde-opencover,代码行数:10,代码来源:CommandLineParserTests.cs

示例4: Detects_EnablePerformanceCounters_Argument

        public void Detects_EnablePerformanceCounters_Argument()
        {
            // arrange
            var parser = new CommandLineParser(new[] { "-enableperformancecounters", RequiredArgs });

            // act
            parser.ExtractAndValidateArguments();

            // assert
            Assert.IsTrue(parser.EnablePerformanceCounters);
        }
开发者ID:nagyist,项目名称:sawilde-opencover,代码行数:11,代码来源:CommandLineParserTests.cs

示例5: DetectsServiceArgument

        public void DetectsServiceArgument()
        {
            // arrange
            var parser = new CommandLineParser(new[] { "-service", RequiredArgs });

            // act
            parser.ExtractAndValidateArguments();

            // assert
            Assert.IsTrue(parser.Service);
        }
开发者ID:nagyist,项目名称:sawilde-opencover,代码行数:11,代码来源:CommandLineParserTests.cs

示例6: HandlesFilterArgument

        public void HandlesFilterArgument()
        {
            // arrange
            var parser = new CommandLineParser(new[]{"-filter:XYZ ABC", RequiredArgs});

            // act
            parser.ExtractAndValidateArguments();

            // assert
            Assert.AreEqual(2, parser.Filters.Count);
        }
开发者ID:mtscout6,项目名称:opencover,代码行数:11,代码来源:CommandLineParserTests.cs

示例7: HandlesNoDefaultFiltersArgument

        public void HandlesNoDefaultFiltersArgument()
        {
            // arrange
            var parser = new CommandLineParser(new[]{"-nodefaultfilters" , RequiredArgs});

            // act
            parser.ExtractAndValidateArguments();

            // assert
            Assert.IsTrue(parser.NoDefaultFilters);
        }
开发者ID:mtscout6,项目名称:opencover,代码行数:11,代码来源:CommandLineParserTests.cs

示例8: DetectsOldStyleArgument

        public void DetectsOldStyleArgument()
        {
            // arrange
            var parser = new CommandLineParser(new[] { "-oldstyle", RequiredArgs });

            // act
            parser.ExtractAndValidateArguments();

            // assert
            Assert.IsTrue(parser.OldStyleInstrumentation);
        }
开发者ID:nagyist,项目名称:sawilde-opencover,代码行数:11,代码来源:CommandLineParserTests.cs

示例9: HandlesReturnTargetCodeArgument

        public void HandlesReturnTargetCodeArgument()
        {
            // arrange
            var parser = new CommandLineParser(new[] { "-returntargetcode", RequiredArgs });

            // act
            parser.ExtractAndValidateArguments();

            // assert
            Assert.IsTrue(parser.ReturnTargetCode);
        }
开发者ID:mtscout6,项目名称:opencover,代码行数:11,代码来源:CommandLineParserTests.cs

示例10: HandlesAnInvalidTypeArgument

        public void HandlesAnInvalidTypeArgument()
        {
            // arrange
            var parser = new CommandLineParser(new[]{"-type:method,boris" , RequiredArgs});

            // act
            var ex = Assert.Catch<Exception>(parser.ExtractAndValidateArguments);

            // assert
            Assert.IsNotNull(ex);
        }
开发者ID:mtscout6,项目名称:opencover,代码行数:11,代码来源:CommandLineParserTests.cs

示例11: HandlesMergeByHashArgument

        public void HandlesMergeByHashArgument()
        {
            // arrange
            var parser = new CommandLineParser(new[] { "-mergebyhash", RequiredArgs });

            // act
            parser.ExtractAndValidateArguments();

            // assert
            Assert.IsTrue(parser.MergeByHash);
        }
开发者ID:mtscout6,项目名称:opencover,代码行数:11,代码来源:CommandLineParserTests.cs

示例12: HandlesTheRegisterArgumentWithPath32Value

        public void HandlesTheRegisterArgumentWithPath32Value()
        {
            // arrange  
            var parser = new CommandLineParser(new[] { "-register:path32", RequiredArgs });

            // act
            parser.ExtractAndValidateArguments();

            // assert
            Assert.IsTrue(parser.Register);
            Assert.AreEqual(Registration.Path32, parser.Registration);
        }
开发者ID:AtwooTM,项目名称:opencover,代码行数:12,代码来源:CommandLineParserTests.cs

示例13: HandlesExcludeByAttributeArgument_WithValue

        public void HandlesExcludeByAttributeArgument_WithValue()
        {
            // arrange
            var parser = new CommandLineParser(new[] { "-excludebyattribute:wibble", RequiredArgs });

            // act
            parser.ExtractAndValidateArguments();

            // assert
            Assert.AreEqual(1, parser.AttributeExclusionFilters.Count);
            Assert.AreEqual("wibble", parser.AttributeExclusionFilters[0]);
        }
开发者ID:tomstaijen,项目名称:opencover,代码行数:12,代码来源:CommandLineParserTests.cs

示例14: CreatePerformanceCounter

 private static IPerfCounters CreatePerformanceCounter(CommandLineParser parser)
 {
     if (parser.EnablePerformanceCounters)
     {
         if (new WindowsPrincipal(WindowsIdentity.GetCurrent()).IsInRole(WindowsBuiltInRole.Administrator))
         {
             return new PerfCounters();
         }
         Logger.Error("You must be running as an Administrator to enable performance counters.");
         throw new ExitApplicationWithoutReportingException();
     }
     return new NullPerfCounter();
 }
开发者ID:stanhuff,项目名称:opencover,代码行数:13,代码来源:Program.cs

示例15: HandlesCoverByTestArgument_WithMultipleValues

        public void HandlesCoverByTestArgument_WithMultipleValues()
        {
            // arrange
            var parser = new CommandLineParser(new[] { "-coverbytest:wibble;wobble;woop", RequiredArgs });

            // act
            parser.ExtractAndValidateArguments();

            // assert
            Assert.AreEqual(3, parser.TestFilters.Count);
            Assert.AreEqual("wibble", parser.TestFilters[0]);
            Assert.AreEqual("wobble", parser.TestFilters[1]);
            Assert.AreEqual("woop", parser.TestFilters[2]);
        }
开发者ID:tomstaijen,项目名称:opencover,代码行数:14,代码来源:CommandLineParserTests.cs


注:本文中的OpenCover.Framework.CommandLineParser类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。