本文整理汇总了C#中System.ConsoleOptions.Validate方法的典型用法代码示例。如果您正苦于以下问题:C# ConsoleOptions.Validate方法的具体用法?C# ConsoleOptions.Validate怎么用?C# ConsoleOptions.Validate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.ConsoleOptions
的用法示例。
在下文中一共展示了ConsoleOptions.Validate方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FixtureNamePlusAssemblyIsValid
public void FixtureNamePlusAssemblyIsValid()
{
ConsoleOptions options = new ConsoleOptions( "-fixture:NUnit.Tests.AllTests", "nunit.tests.dll" );
Assert.AreEqual("nunit.tests.dll", options.Parameters[0]);
Assert.AreEqual("NUnit.Tests.AllTests", options.fixture);
Assert.IsTrue(options.Validate());
}
示例2: ExcludeCategories
public void ExcludeCategories()
{
ConsoleOptions options = new ConsoleOptions( "tests.dll", "-exclude:Database;Slow" );
Assert.IsTrue( options.Validate() );
Assert.IsNotNull(options.exclude);
Assert.AreEqual(options.exclude, "Database;Slow");
Assert.IsTrue(options.HasExclude);
string[] categories = options.ExcludedCategories;
Assert.IsNotNull(categories);
Assert.AreEqual(2, categories.Length);
Assert.AreEqual("Database", categories[0]);
Assert.AreEqual("Slow", categories[1]);
}
示例3: ExploreOptionWithoutPath
public void ExploreOptionWithoutPath()
{
ConsoleOptions options = new ConsoleOptions("tests.dll", "-explore");
Assert.True(options.Validate());
Assert.True(options.Explore);
}
示例4: ResultOptionMayBeRepeated
public void ResultOptionMayBeRepeated()
{
ConsoleOptions options = new ConsoleOptions("tests.dll", "-result:results.xml", "-result:nunit2results.xml;format=nunit2", "-result:myresult.xml;transform=mytransform.xslt");
Assert.True(options.Validate(), "Should be valid");
var specs = options.ResultOutputSpecifications;
Assert.AreEqual(3, specs.Count);
var spec1 = specs[0];
Assert.AreEqual("results.xml", spec1.OutputPath);
Assert.AreEqual("nunit3", spec1.Format);
Assert.Null(spec1.Transform);
var spec2 = specs[1];
Assert.AreEqual("nunit2results.xml", spec2.OutputPath);
Assert.AreEqual("nunit2", spec2.Format);
Assert.Null(spec2.Transform);
var spec3 = specs[2];
Assert.AreEqual("myresult.xml", spec3.OutputPath);
Assert.AreEqual("user", spec3.Format);
Assert.AreEqual("mytransform.xslt", spec3.Transform);
}
示例5: NoInputFiles
public void NoInputFiles()
{
ConsoleOptions options = new ConsoleOptions();
Assert.True(options.Validate());
Assert.AreEqual(0, options.InputFiles.Count);
}
示例6: FileNameWithoutXmlParameterLooksLikeParameter
public void FileNameWithoutXmlParameterLooksLikeParameter()
{
ConsoleOptions options = new ConsoleOptions( "tests.dll", "result.xml" );
Assert.IsTrue(options.Validate());
Assert.AreEqual(2, options.Parameters.Count);
}
示例7: IncludeAndExcludeAreInvalidTogether
public void IncludeAndExcludeAreInvalidTogether()
{
ConsoleOptions options = new ConsoleOptions( "tests.dll", "-include:Database;Slow", "-exclude:Fast" );
Assert.IsFalse( options.Validate() );
}
示例8: FileNameWithoutXmlParameterIsInvalid
public void FileNameWithoutXmlParameterIsInvalid()
{
ConsoleOptions options = new ConsoleOptions( "tests.dll", ":result.xml" );
Assert.IsFalse(options.Validate());
}
示例9: 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.ToLower(CultureInfo.InvariantCulture);
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);
}
}
示例10: TimeoutIsMinusOneIfNoOptionIsProvided
public void TimeoutIsMinusOneIfNoOptionIsProvided()
{
ConsoleOptions options = new ConsoleOptions("tests.dll");
Assert.True(options.Validate());
Assert.AreEqual(-1, options.DefaultTimeout);
}
示例11: TimeoutParsesIntValueCorrectly
public void TimeoutParsesIntValueCorrectly()
{
ConsoleOptions options = new ConsoleOptions("tests.dll", "-timeout:5000");
Assert.True(options.Validate());
Assert.AreEqual(5000, options.DefaultTimeout);
}
示例12: InvalidOption
public void InvalidOption()
{
ConsoleOptions options = new ConsoleOptions("-asembly:nunit.tests.dll");
Assert.False(options.Validate());
Assert.AreEqual(1, options.ErrorMessages.Count);
Assert.AreEqual("Invalid argument: -asembly:nunit.tests.dll", options.ErrorMessages[0]);
}
示例13: 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]);
}
示例14: 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");
}
示例15: 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]);
}