Skip to content

Commit

Permalink
cake-buildGH-2039: Fix XUnit2Settings + XUnit2Runner to honor explici…
Browse files Browse the repository at this point in the history
…t specifications of ParallelismOption.None
  • Loading branch information
kcamp committed Mar 8, 2018
1 parent 6774499 commit e2687b2
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
5 changes: 3 additions & 2 deletions src/Cake.Common.Tests/Unit/Tools/XUnit/XUnit2RunnerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -542,11 +542,12 @@ public void Should_Not_Use_App_Domains_If_Disabled_In_Settings()
}

[Theory]
[InlineData(null, "\"/Working/Test1.dll\"")]
[InlineData(ParallelismOption.All, "\"/Working/Test1.dll\" -parallel all")]
[InlineData(ParallelismOption.Assemblies, "\"/Working/Test1.dll\" -parallel assemblies")]
[InlineData(ParallelismOption.Collections, "\"/Working/Test1.dll\" -parallel collections")]
[InlineData(ParallelismOption.None, "\"/Working/Test1.dll\"")]
public void Should_Use_Parallel_Switch_If_Settings_Value_Is_Not_None(ParallelismOption option, string expected)
[InlineData(ParallelismOption.None, "\"/Working/Test1.dll\" -parallel none")]
public void Should_Use_Parallel_Switch_If_Settings_Value_Is_Specified(ParallelismOption? option, string expected)
{
// Given
var fixture = new XUnit2RunnerFixture();
Expand Down
4 changes: 2 additions & 2 deletions src/Cake.Common.Tests/Unit/Tools/XUnit/XUnit2SettingsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,13 @@ public void Should_Set_NoAppDomain_To_False_By_Default()
}

[Fact]
public void Should_Set_Parallelism_Option_To_None_By_Default()
public void Should_Set_Parallelism_Option_To_Null_By_Default()
{
// Given, When
var settings = new XUnit2Settings();

// Then
Assert.Equal(settings.Parallelism, ParallelismOption.None);
Assert.Null(settings.Parallelism);
}

[Fact]
Expand Down
2 changes: 1 addition & 1 deletion src/Cake.Common/Tools/XUnit/XUnit2Runner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ private ProcessArgumentBuilder GetArguments(IReadOnlyList<FilePath> assemblyPath
}

// parallelize test execution?
if (settings.Parallelism != ParallelismOption.None)
if (settings.Parallelism.HasValue)
{
builder.Append("-parallel " + settings.Parallelism.ToString().ToLowerInvariant());
}
Expand Down
2 changes: 1 addition & 1 deletion src/Cake.Common/Tools/XUnit/XUnit2Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public sealed class XUnit2Settings : ToolSettings
/// <value>
/// The parallelism option.
/// </value>
public ParallelismOption Parallelism { get; set; }
public ParallelismOption? Parallelism { get; set; }

/// <summary>
/// Gets or sets a value indicating whether to run tests in using x86 test runner.
Expand Down

0 comments on commit e2687b2

Please sign in to comment.