Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

method scope fix #4415

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Adapter/MSTest.TestAdapter/MSTestSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1029,7 +1029,7 @@ internal static void SetSettingsFromConfig(IConfiguration configuration, IMessag
if (configuration["mstest:parallelism:scope"] is string value)
{
value = value.Equals("class", StringComparison.OrdinalIgnoreCase) ? "ClassLevel"
: value.Equals("methood", StringComparison.OrdinalIgnoreCase) ? "MethodLevel" : value;
: value.Equals("method", StringComparison.OrdinalIgnoreCase) ? "MethodLevel" : value;
if (TryParseEnum(value, out ExecutionScope scope))
{
settings.ParallelizationScope = scope;
Expand Down
20 changes: 20 additions & 0 deletions test/UnitTests/MSTestAdapter.UnitTests/MSTestSettingsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1374,5 +1374,25 @@ public void ConfigJson_WithValidValues_ValuesAreSetCorrectly()
Verify(settings.ParallelizationWorkers == 4);
Verify(settings.ParallelizationScope == ExecutionScope.ClassLevel);
}

[TestMethod]
public void ConfigJson_WithValidValues_MethodScope()
{
// Arrange - setting up valid configuration values
var configDictionary = new Dictionary<string, string> { { "mstest:parallelism:scope", "method" } };

var mockConfig = new Mock<IConfiguration>();
mockConfig.Setup(config => config[It.IsAny<string>()])
.Returns((string key) => configDictionary.TryGetValue(key, out string value) ? value : null);

var settings = new MSTestSettings();

// Act
MSTestSettings.SetSettingsFromConfig(mockConfig.Object, _mockMessageLogger.Object, settings);

// Assert
Verify(settings.ParallelizationScope == ExecutionScope.MethodLevel);
}

#endregion
}
Loading