本文整理汇总了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);
}
}
示例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"]);
}
示例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"]);
}
示例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"]);
}
示例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);
}
示例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);
}
示例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));
}
示例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);
}
示例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]);
}
示例10: TimeoutIsMinusOneIfNoOptionIsProvided
public void TimeoutIsMinusOneIfNoOptionIsProvided()
{
ConsoleOptions options = new ConsoleOptions("tests.dll");
Assert.True(options.Validate());
Assert.AreEqual(-1, options.DefaultTimeout);
}
示例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]);
}
示例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);
}
示例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);
}
示例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]);
}
示例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);
}