Skip to content

Commit

Permalink
Update to 2.7.2-pre.17 and support Xunit.ParallelAlgorithm in RunSett…
Browse files Browse the repository at this point in the history
…tings
  • Loading branch information
bradwilson committed Apr 23, 2024
1 parent 144931e commit 3c2e493
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<NSubstituteVersion>5.1.0</NSubstituteVersion>
<TunnelVisionLabsReferenceAssemblyAnnotatorVersion>1.0.0-alpha.160</TunnelVisionLabsReferenceAssemblyAnnotatorVersion>
<XunitAnalyzersVersion>1.12.0</XunitAnalyzersVersion>
<XunitVersion>2.7.1</XunitVersion>
<XunitVersion>2.7.2-pre.17</XunitVersion>
</PropertyGroup>

</Project>
8 changes: 8 additions & 0 deletions src/xunit.runner.visualstudio/Utility/RunSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public class RunSettings
public TestMethodDisplay? MethodDisplay { get; set; }
public TestMethodDisplayOptions? MethodDisplayOptions { get; set; }
public bool? NoAutoReporters { get; set; }
public ParallelAlgorithm? ParallelAlgorithm { get; set; }
public bool? ParallelizeAssembly { get; set; }
public bool? ParallelizeTestCollections { get; set; }
public bool? PreEnumerateTheories { get; set; }
Expand All @@ -42,6 +43,8 @@ public void CopyTo(TestAssemblyConfiguration configuration)
configuration.MethodDisplay = MethodDisplay;
if (MethodDisplayOptions.HasValue)
configuration.MethodDisplayOptions = MethodDisplayOptions;
if (ParallelAlgorithm.HasValue)
configuration.ParallelAlgorithm = ParallelAlgorithm;
if (ParallelizeAssembly.HasValue)
configuration.ParallelizeAssembly = ParallelizeAssembly;
if (ParallelizeTestCollections.HasValue)
Expand Down Expand Up @@ -106,6 +109,10 @@ public static RunSettings Parse(string? settingsXml)
if (bool.TryParse(noAutoReportersString, out var noAutoReporters))
result.NoAutoReporters = noAutoReporters;

var parallelAlgorithmString = xunitElement.Element(Constants.Xunit.ParallelAlgorithm)?.Value;
if (Enum.TryParse<ParallelAlgorithm>(parallelAlgorithmString, ignoreCase: true, out var parallelAlgorithm))
result.ParallelAlgorithm = parallelAlgorithm;

var parallelizeAssemblyString = xunitElement.Element(Constants.Xunit.ParallelizeAssembly)?.Value;
if (bool.TryParse(parallelizeAssemblyString, out var parallelizeAssembly))
result.ParallelizeAssembly = parallelizeAssembly;
Expand Down Expand Up @@ -209,6 +216,7 @@ public static class Xunit
public const string MethodDisplay = "MethodDisplay";
public const string MethodDisplayOptions = "MethodDisplayOptions";
public const string NoAutoReporters = "NoAutoReporters";
public const string ParallelAlgorithm = "ParallelAlgorithm";
public const string ParallelizeAssembly = "ParallelizeAssembly";
public const string ParallelizeTestCollections = "ParallelizeTestCollections";
public const string PreEnumerateTheories = "PreEnumerateTheories";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,5 +64,5 @@
</NuspecProperties>
</PropertyGroup>
</Target>

</Project>

0 comments on commit 3c2e493

Please sign in to comment.