Add -params option to NUnitLite
This commit is contained in:
Родитель
f061db4523
Коммит
1edc4545ee
|
@ -36,7 +36,7 @@ namespace NUnitLite.Tests
|
|||
[TestFixture]
|
||||
public class CommandLineTests
|
||||
{
|
||||
#region General Tests
|
||||
#region General Tests
|
||||
|
||||
[Test]
|
||||
public void NoInputFiles()
|
||||
|
@ -245,9 +245,9 @@ namespace NUnitLite.Tests
|
|||
Assert.AreEqual("Invalid argument: -assembly:Tests.dll", options.ErrorMessages[1]);
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
#region Timeout Option
|
||||
#region Timeout Option
|
||||
|
||||
[Test]
|
||||
public void TimeoutIsMinusOneIfNoOptionIsProvided()
|
||||
|
@ -279,9 +279,9 @@ namespace NUnitLite.Tests
|
|||
Assert.AreEqual(-1, options.DefaultTimeout);
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
#region EngineResult Option
|
||||
#region EngineResult Option
|
||||
|
||||
[Test]
|
||||
public void FileNameWithoutResultOptionLooksLikeParameter()
|
||||
|
@ -502,6 +502,64 @@ namespace NUnitLite.Tests
|
|||
|
||||
#endregion
|
||||
|
||||
#region Test Parameters
|
||||
|
||||
[Test]
|
||||
public void SingleTestParameter()
|
||||
{
|
||||
var options = new NUnitLiteOptions("--params=X=5");
|
||||
Assert.That(options.errorMessages, Is.Empty);
|
||||
Assert.That(options.TestParameters, Is.EqualTo("X=5"));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TwoTestParametersInOneOption()
|
||||
{
|
||||
var options = new NUnitLiteOptions("--params:X=5;Y=7");
|
||||
Assert.That(options.errorMessages, Is.Empty);
|
||||
Assert.That(options.TestParameters, Is.EqualTo("X=5;Y=7"));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TwoTestParametersInSeparateOptions()
|
||||
{
|
||||
var options = new NUnitLiteOptions("-p:X=5", "-p:Y=7");
|
||||
Assert.That(options.errorMessages, Is.Empty);
|
||||
Assert.That(options.TestParameters, Is.EqualTo("X=5;Y=7"));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ThreeTestParametersInTwoOptions()
|
||||
{
|
||||
var options = new NUnitLiteOptions("--params:X=5;Y=7", "-p:Z=3");
|
||||
Assert.That(options.errorMessages, Is.Empty);
|
||||
Assert.That(options.TestParameters, Is.EqualTo("X=5;Y=7;Z=3"));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ParameterWithoutEqualSignIsInvalid()
|
||||
{
|
||||
var options = new NUnitLiteOptions("--params=X5");
|
||||
Assert.That(options.ErrorMessages.Count, Is.EqualTo(1));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void DisplayTestParameters()
|
||||
{
|
||||
if (TestContext.Parameters.Count == 0)
|
||||
{
|
||||
Console.WriteLine("No Test Parameters were passed");
|
||||
return;
|
||||
}
|
||||
|
||||
Console.WriteLine("Test Parameters---");
|
||||
|
||||
foreach (var name in TestContext.Parameters.Names)
|
||||
Console.WriteLine(" Name: {0} Value: {1}", name, TestContext.Parameters[name]);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Helper Methods
|
||||
|
||||
//private static FieldInfo GetFieldInfo(string fieldName)
|
||||
|
@ -518,7 +576,7 @@ namespace NUnitLite.Tests
|
|||
return property;
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
internal sealed class DefaultOptionsProviderStub : IDefaultOptionsProvider
|
||||
{
|
||||
|
|
|
@ -260,7 +260,7 @@ namespace NUnitLite
|
|||
#endif
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
#region Helper Methods
|
||||
|
||||
|
@ -358,6 +358,9 @@ namespace NUnitLite
|
|||
if (options.DefaultTestNamePattern != null)
|
||||
runSettings[FrameworkPackageSettings.DefaultTestNamePattern] = options.DefaultTestNamePattern;
|
||||
|
||||
if (options.TestParameters != null)
|
||||
runSettings[FrameworkPackageSettings.TestParameters] = options.TestParameters;
|
||||
|
||||
return runSettings;
|
||||
}
|
||||
|
||||
|
@ -380,7 +383,7 @@ namespace NUnitLite
|
|||
? new OrFilter(testFilters.ToArray())
|
||||
: testFilters[0];
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (options.WhereClauseSpecified)
|
||||
{
|
||||
|
|
|
@ -356,6 +356,9 @@
|
|||
<ItemGroup>
|
||||
<None Include="Properties\InBrowserSettings.xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Silverlight\$(SilverlightVersion)\Microsoft.Silverlight.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
|
|
Загрузка…
Ссылка в новой задаче