本文整理汇总了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);
}
示例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);
}
示例3: TimeoutParsesIntValueCorrectly
public void TimeoutParsesIntValueCorrectly()
{
ConsoleOptions options = new ConsoleOptions("tests.dll", "-timeout:5000");
Assert.True(options.Validate());
Assert.AreEqual(5000, options.DefaultTimeout);
}
示例4: TimeoutCausesErrorIfValueIsNotInteger
public void TimeoutCausesErrorIfValueIsNotInteger()
{
ConsoleOptions options = new ConsoleOptions("tests.dll", "-timeout:abc");
Assert.False(options.Validate());
Assert.AreEqual(-1, options.DefaultTimeout);
}
示例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);
}
示例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]);
}
示例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");
}
示例8: NoInputFiles
public void NoInputFiles()
{
ConsoleOptions options = new ConsoleOptions();
Assert.True(options.Validate());
Assert.AreEqual(0, options.InputFiles.Count);
}
示例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]);
}
示例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]);
}
示例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);
}
}
示例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);
}
}
}
示例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");
}
示例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");
}
示例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]);
}