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


C# Common.ConsoleOptions类代码示例

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


ConsoleOptions类属于NUnit.Common命名空间,在下文中一共展示了ConsoleOptions类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CanRecognizeBooleanOptions

        public void CanRecognizeBooleanOptions(string propertyName, string pattern)
        {
            string[] prototypes = pattern.Split('|');

            PropertyInfo property = GetPropertyInfo(propertyName);
            Assert.AreEqual(typeof(bool), property.PropertyType, "Property '{0}' is wrong type", propertyName);

            foreach (string option in prototypes)
            {
                ConsoleOptions options;

                if (option.Length == 1)
                {
                    options = new ConsoleOptions("-" + option);
                    Assert.AreEqual(true, (bool)property.GetValue(options, null), "Didn't recognize -" + option);

                    options = new ConsoleOptions("-" + option + "+");
                    Assert.AreEqual(true, (bool)property.GetValue(options, null), "Didn't recognize -" + option + "+");

                    options = new ConsoleOptions("-" + option + "-");
                    Assert.AreEqual(false, (bool)property.GetValue(options, null), "Didn't recognize -" + option + "-");
                }
                else
                {
                    options = new ConsoleOptions("--" + option);
                    Assert.AreEqual(true, (bool)property.GetValue(options, null), "Didn't recognize --" + option);
                }

                options = new ConsoleOptions("/" + option);
                Assert.AreEqual(true, (bool)property.GetValue(options, null), "Didn't recognize /" + option);
            }
        }
开发者ID:nahugrau,项目名称:nunit,代码行数:32,代码来源:CommandLineTests.cs

示例2: WhenTimeoutIsSpecified_RunSettingsIncludeIt

        public void WhenTimeoutIsSpecified_RunSettingsIncludeIt()
        {
            var options = new ConsoleOptions("test.dll", "--timeout=50");
            var settings = TextRunner.MakeRunSettings(options);

            Assert.That(settings.ContainsKey("DefaultTimeout"));
            Assert.AreEqual(50, settings["DefaultTimeout"]);
        }
开发者ID:JohanLarsson,项目名称:nunit,代码行数:8,代码来源:MakeRunSettingsTests.cs

示例3: WhenWorkDirectoryIsSpecified_RunSettingsIncludeIt

        public void WhenWorkDirectoryIsSpecified_RunSettingsIncludeIt()
        {
            var options = new ConsoleOptions("test.dll", "--work=results");
            var settings = TextRunner.MakeRunSettings(options);

            Assert.That(settings.ContainsKey("WorkDirectory"));
            Assert.AreEqual(Path.GetFullPath("results"), settings["WorkDirectory"]);
        }
开发者ID:JohanLarsson,项目名称:nunit,代码行数:8,代码来源:MakeRunSettingsTests.cs

示例4: WhenSeedIsSpecified_RunSettingsIncludeIt

        public void WhenSeedIsSpecified_RunSettingsIncludeIt()
        {
            var options = new ConsoleOptions("test.dll", "--seed=1234");
            var settings = TextRunner.MakeRunSettings(options);

            Assert.That(settings.ContainsKey("RandomSeed"));
            Assert.AreEqual(1234, settings["RandomSeed"]);
        }
开发者ID:JohanLarsson,项目名称:nunit,代码行数:8,代码来源:MakeRunSettingsTests.cs

示例5: SingleAssembly

        public void SingleAssembly()
        {
            var options = new ConsoleOptions("test.dll");
            var package = ConsoleRunner.MakeTestPackage(options);

            Assert.AreEqual(1, package.SubPackages.Count);
            Assert.AreEqual(Path.GetFullPath("test.dll"), package.SubPackages[0].FullName);
        }
开发者ID:acco32,项目名称:nunit,代码行数:8,代码来源:MakeTestPackageTests.cs

示例6: WhenOptionIsSpecified_PackageIncludesSetting

        public void WhenOptionIsSpecified_PackageIncludesSetting(string option, string key, object val)
        {
            var options = new ConsoleOptions("test.dll", option);
            var package = ConsoleRunner.MakeTestPackage(options);

            Assert.That(package.Settings.ContainsKey(key), "Setting not included for {0}", option);
            Assert.AreEqual(val, package.Settings[key], "NumberOfTestWorkers not set correctly for {0}", option);
        }
开发者ID:acco32,项目名称:nunit,代码行数:8,代码来源:MakeTestPackageTests.cs

示例7: WhenDebugging_NumberOfTestWorkersDefaultsToZero

        public void WhenDebugging_NumberOfTestWorkersDefaultsToZero()
        {
            var options = new ConsoleOptions("test.dll", "--debug");
            var package = ConsoleRunner.MakeTestPackage(options);

            Assert.That(package.Settings["DebugTests"], Is.EqualTo(true));
            Assert.That(package.Settings["NumberOfTestWorkers"], Is.EqualTo(0));
        }
开发者ID:rbenhassine2,项目名称:nunit,代码行数:8,代码来源:MakeTestPackageTests.cs

示例8: MultipleAssemblies

        public void MultipleAssemblies()
        {
            var names = new [] { "test1.dll", "test2.dll", "test3.dll" };
            var options = new ConsoleOptions(names);
            var package = ConsoleRunner.MakeTestPackage(options);

            Assert.AreEqual(3, package.SubPackages.Count);
            Assert.AreEqual(Path.GetFullPath("test1.dll"), package.SubPackages[0].FullName);
            Assert.AreEqual(Path.GetFullPath("test2.dll"), package.SubPackages[1].FullName);
            Assert.AreEqual(Path.GetFullPath("test3.dll"), package.SubPackages[2].FullName);
        }
开发者ID:acco32,项目名称:nunit,代码行数:11,代码来源:MakeTestPackageTests.cs

示例9: InvalidOption

 public void InvalidOption()
 {
     ConsoleOptions options = new ConsoleOptions("-assembly:nunit.tests.dll");
     Assert.False(options.Validate());
     Assert.AreEqual(1, options.ErrorMessages.Count);
     Assert.AreEqual("Invalid argument: -assembly:nunit.tests.dll", options.ErrorMessages[0]);
 }
开发者ID:nahugrau,项目名称:nunit,代码行数:7,代码来源:CommandLineTests.cs

示例10: TimeoutIsMinusOneIfNoOptionIsProvided

 public void TimeoutIsMinusOneIfNoOptionIsProvided()
 {
     ConsoleOptions options = new ConsoleOptions("tests.dll");
     Assert.True(options.Validate());
     Assert.AreEqual(-1, options.DefaultTimeout);
 }
开发者ID:nahugrau,项目名称:nunit,代码行数:6,代码来源:CommandLineTests.cs

示例11: InvalidCommandLineParms

 public void InvalidCommandLineParms()
 {
     ConsoleOptions options = new ConsoleOptions("-garbage:TestFixture", "-assembly:Tests.dll");
     Assert.False(options.Validate());
     Assert.AreEqual(2, options.ErrorMessages.Count);
     Assert.AreEqual("Invalid argument: -garbage:TestFixture", options.ErrorMessages[0]);
     Assert.AreEqual("Invalid argument: -assembly:Tests.dll", options.ErrorMessages[1]);
 }
开发者ID:nahugrau,项目名称:nunit,代码行数:8,代码来源:CommandLineTests.cs

示例12: ExploreOptionWithFilePathUsingEqualSign

 public void ExploreOptionWithFilePathUsingEqualSign()
 {
     ConsoleOptions options = new ConsoleOptions("tests.dll", "-explore=C:/nunit/tests/bin/Debug/console-test.xml");
     Assert.True(options.Validate());
     Assert.True(options.Explore);
     Assert.AreEqual(1, options.InputFiles.Count, "assembly should be set");
     Assert.AreEqual("tests.dll", options.InputFiles[0]);
     Assert.AreEqual("C:/nunit/tests/bin/Debug/console-test.xml", options.ExploreOutputSpecifications[0].OutputPath);
 }
开发者ID:nahugrau,项目名称:nunit,代码行数:9,代码来源:CommandLineTests.cs

示例13: ShouldSetTeamCityFlagAccordingToArgsAndDefauls

        public void ShouldSetTeamCityFlagAccordingToArgsAndDefauls(bool hasTeamcityInCmd, bool? defaultTeamcity, bool expectedTeamCity)
        {
            // Given
            List<string> args = new List<string> { "tests.dll" };
            if (hasTeamcityInCmd)
            {
                args.Add("--teamcity");
            }

            ConsoleOptions options;
            if (defaultTeamcity.HasValue)
            {
                options = new ConsoleOptions(new DefaultOptionsProviderStub(defaultTeamcity.Value), args.ToArray());
            }
            else
            {
                options = new ConsoleOptions(args.ToArray());
            }

            // When
            var actualTeamCity = options.TeamCity;

            // Then
            Assert.AreEqual(actualTeamCity, expectedTeamCity);
        }
开发者ID:nahugrau,项目名称:nunit,代码行数:25,代码来源:CommandLineTests.cs

示例14: AssemblyName

 public void AssemblyName()
 {
     ConsoleOptions options = new ConsoleOptions("nunit.tests.dll");
     Assert.True(options.Validate());
     Assert.AreEqual(1, options.InputFiles.Count);
     Assert.AreEqual("nunit.tests.dll", options.InputFiles[0]);
 }
开发者ID:nahugrau,项目名称:nunit,代码行数:7,代码来源:CommandLineTests.cs

示例15: ResultOptionWithFilePathAndFormat

        public void ResultOptionWithFilePathAndFormat()
        {
            ConsoleOptions options = new ConsoleOptions("tests.dll", "-result:results.xml;format=nunit2");
            Assert.True(options.Validate());
            Assert.AreEqual(1, options.InputFiles.Count, "assembly should be set");
            Assert.AreEqual("tests.dll", options.InputFiles[0]);

            OutputSpecification spec = options.ResultOutputSpecifications[0];
            Assert.AreEqual("results.xml", spec.OutputPath);
            Assert.AreEqual("nunit2", spec.Format);
            Assert.Null(spec.Transform);
        }
开发者ID:nahugrau,项目名称:nunit,代码行数:12,代码来源:CommandLineTests.cs


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