Skip to content

Commit

Permalink
add method scope test
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonCropp committed Dec 21, 2024
1 parent 378afeb commit 9d9aa05
Showing 1 changed file with 20 additions and 0 deletions.
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
}

0 comments on commit 9d9aa05

Please sign in to comment.