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


C# ConsoleOptions.Validate方法代码示例

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


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

示例1: 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:rbenhassine2,项目名称:nunit,代码行数:12,代码来源:CommandLineTests.cs

示例2: FileNameWithoutResultOptionLooksLikeParameter

 public void FileNameWithoutResultOptionLooksLikeParameter()
 {
     ConsoleOptions options = new ConsoleOptions("tests.dll", "results.xml");
     Assert.True(options.Validate());
     Assert.AreEqual(0, options.ErrorMessages.Count);
     Assert.AreEqual(2, options.InputFiles.Count);
 }
开发者ID:rbenhassine2,项目名称:nunit,代码行数:7,代码来源:CommandLineTests.cs

示例3: TimeoutParsesIntValueCorrectly

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

示例4: TimeoutCausesErrorIfValueIsNotInteger

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

示例5: ExploreOptionWithFilePathAndTransform

        public void ExploreOptionWithFilePathAndTransform()
        {
            ConsoleOptions options = new ConsoleOptions("tests.dll", "-explore:results.xml;transform=myreport.xslt");
            Assert.True(options.Validate());
            Assert.AreEqual(1, options.InputFiles.Count, "assembly should be set");
            Assert.AreEqual("tests.dll", options.InputFiles[0]);
            Assert.True(options.Explore);

            OutputSpecification spec = options.ExploreOutputSpecifications[0];
            Assert.AreEqual("results.xml", spec.OutputPath);
            Assert.AreEqual("user", spec.Format);
            Assert.AreEqual("myreport.xslt", spec.Transform);
        }
开发者ID:rbenhassine2,项目名称:nunit,代码行数:13,代码来源:CommandLineTests.cs

示例6: X86AndInProcessAreNotCompatibleIn64BitProcess

 public void X86AndInProcessAreNotCompatibleIn64BitProcess()
 {
     ConsoleOptions options = new ConsoleOptions("nunit.tests.dll", "--x86", "--inprocess");
     Assert.False(options.Validate(), "Should be invalid");
     Assert.AreEqual("The --x86 and --inprocess options are incompatible.", options.ErrorMessages[0]);
 }
开发者ID:ChrisMaddock,项目名称:nunit,代码行数:6,代码来源:CommandLineTests.cs

示例7: AssemblyAloneIsValid

 public void AssemblyAloneIsValid()
 {
     ConsoleOptions options = new ConsoleOptions("nunit.tests.dll");
     Assert.True(options.Validate());
     Assert.AreEqual(0, options.ErrorMessages.Count, "command line should be valid");
 }
开发者ID:rbenhassine2,项目名称:nunit,代码行数:6,代码来源:CommandLineTests.cs

示例8: NoInputFiles

 public void NoInputFiles()
 {
     ConsoleOptions options = new ConsoleOptions();
     Assert.True(options.Validate());
     Assert.AreEqual(0, options.InputFiles.Count);
 }
开发者ID:rbenhassine2,项目名称:nunit,代码行数:6,代码来源:CommandLineTests.cs

示例9: MissingValuesAreReported

 public void MissingValuesAreReported(string option)
 {
     ConsoleOptions options = new ConsoleOptions(option + "=");
     Assert.False(options.Validate(), "Missing value should not be valid");
     Assert.AreEqual("Missing required value for option '" + option + "'.", options.ErrorMessages[0]);
 }
开发者ID:rbenhassine2,项目名称:nunit,代码行数:6,代码来源:CommandLineTests.cs

示例10: 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:rbenhassine2,项目名称:nunit,代码行数:7,代码来源:CommandLineTests.cs

示例11: CanRecognizeLowerCaseOptionValues

        public void CanRecognizeLowerCaseOptionValues(string propertyName, string optionName, string[] canonicalValues)
        {
            PropertyInfo property = GetPropertyInfo(propertyName);
            Assert.AreEqual(typeof(string), property.PropertyType);

            foreach (string canonicalValue in canonicalValues)
            {
                string lowercaseValue = canonicalValue.ToLowerInvariant();
                string optionPlusValue = string.Format("--{0}:{1}", optionName, lowercaseValue);
                ConsoleOptions options = new ConsoleOptions(optionPlusValue);
                Assert.True(options.Validate(), "Should be valid: " + optionPlusValue);
                Assert.AreEqual(canonicalValue, (string)property.GetValue(options, null), "Didn't recognize " + optionPlusValue);
            }
        }
开发者ID:rbenhassine2,项目名称:nunit,代码行数:14,代码来源:CommandLineTests.cs

示例12: CanRecognizeStringOptions

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

            PropertyInfo property = GetPropertyInfo(propertyName);
            Assert.AreEqual(typeof(string), property.PropertyType);

            foreach (string option in prototypes)
            {
                foreach (string value in goodValues)
                {
                    string optionPlusValue = string.Format("--{0}:{1}", option, value);
                    ConsoleOptions options = new ConsoleOptions(optionPlusValue);
                    Assert.True(options.Validate(), "Should be valid: " + optionPlusValue);
                    Assert.AreEqual(value, (string)property.GetValue(options, null), "Didn't recognize " + optionPlusValue);
                }

                foreach (string value in badValues)
                {
                    string optionPlusValue = string.Format("--{0}:{1}", option, value);
                    ConsoleOptions options = new ConsoleOptions(optionPlusValue);
                    Assert.False(options.Validate(), "Should not be valid: " + optionPlusValue);
                }
            }
        }
开发者ID:rbenhassine2,项目名称:nunit,代码行数:25,代码来源:CommandLineTests.cs

示例13: CanRegognizeInProcessOption

 public void CanRegognizeInProcessOption()
 {
     ConsoleOptions options = new ConsoleOptions("--inprocess");
     Assert.True(options.Validate(), "Should be valid: --inprocess");
     Assert.AreEqual("InProcess", options.ProcessModel, "Didn't recognize --inprocess");
 }
开发者ID:nahugrau,项目名称:nunit,代码行数:6,代码来源:CommandLineTests.cs

示例14: ResultOptionWithoutFileNameIsInvalid

 public void ResultOptionWithoutFileNameIsInvalid()
 {
     ConsoleOptions options = new ConsoleOptions("tests.dll", "-result:");
     Assert.False(options.Validate(), "Should not be valid");
     Assert.AreEqual(1, options.ErrorMessages.Count, "An error was expected");
 }
开发者ID:rbenhassine2,项目名称:nunit,代码行数:6,代码来源:CommandLineTests.cs

示例15: 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:rbenhassine2,项目名称:nunit,代码行数:7,代码来源:CommandLineTests.cs


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