Upgrade to MSTest4 - #438
Merged
Merged
Conversation
xj-ms
requested review from
helenkzhang,
jmaxson-ms,
malavshah11 and
trgibeau
as code owners
July 28, 2026 02:54
There was a problem hiding this comment.
Pull request overview
This PR updates the repository’s .NET test toolchain to MSTest v4 and a newer Microsoft.NET.Test.Sdk, and performs the mechanical test code updates needed to compile and behave correctly under the new MSTest APIs.
Changes:
- Bumps centrally-managed test package versions in
src/Directory.Build.targets(MSTest.TestAdapter/TestFramework, Microsoft.NET.Test.Sdk). - Updates select test projects to rely on centrally-managed versions and bumps ancillary test dependencies (e.g., Moq, coverlet.collector).
- Replaces
Assert.ThrowsException*withAssert.ThrowsExactly*and modernizes assert messages to interpolated strings; adjustsAssertExto account for removed formatted-message overloads.
Show a summary per file
| File | Description |
|---|---|
| src/Directory.Build.targets | Central version bumps for MSTest + Microsoft.NET.Test.Sdk. |
| src/PluginsSystem/Microsoft.Performance.Toolkit.Plugins.Core.Tests/Microsoft.Performance.Toolkit.Plugins.Core.Tests.csproj | Moves MSTest/NET.Test.Sdk to central versions; bumps Moq/coverlet. |
| src/PluginsSystem/Microsoft.Performance.Toolkit.Plugins.Runtime.Tests/Microsoft.Performance.Toolkit.Plugins.Runtime.Tests.csproj | Moves MSTest/NET.Test.Sdk to central versions; bumps Moq/coverlet. |
| src/PluginsSystem/Microsoft.Performance.Toolkit.Plugins.Runtime.Tests/PluginSourcesRepositoryTests.cs | Switches null-guard tests to ThrowsExactly. |
| src/PluginsSystem/Microsoft.Performance.Toolkit.Plugins.Runtime.Tests/FileSystemPluginRegistryTests.cs | Updates async exception assertions to ThrowsExactlyAsync. |
| src/PluginsSystem/Microsoft.Performance.Toolkit.Plugins.Runtime.Tests/FileSystemInstalledPluginStorageTests.cs | Updates async exception assertion to ThrowsExactlyAsync. |
| src/Microsoft.Performance.Testing/AssertEx.cs | Adjusts helper asserts for MSTest v4 overload changes. |
| src/Microsoft.Performance.Toolkit.Engine.Tests/ToolkitEngineTests.cs | Replaces throws asserts and converts formatted messages to interpolated strings; resolves AreNotSame ambiguity. |
| src/Microsoft.Performance.Toolkit.Engine.Tests/ToolkitEngineCreateInfoTests.cs | Switches to ThrowsExactly. |
| src/Microsoft.Performance.Toolkit.Engine.Tests/PluginSetTests.cs | Switches to ThrowsExactly. |
| src/Microsoft.Performance.Toolkit.Engine.Tests/EngineFixture.cs | Converts Assert.Fail composite formatting to interpolated strings. |
| src/Microsoft.Performance.Toolkit.Engine.Tests/DataSourceSetTests.cs | Switches to ThrowsExactly. |
| src/Microsoft.Performance.SDK.Tests/TypeExtensionTests.cs | Switches to ThrowsExactly. |
| src/Microsoft.Performance.SDK.Tests/TestClasses/TableDescriptorUtils.cs | Converts composite-format assert messages to interpolated strings. |
| src/Microsoft.Performance.SDK.Tests/TableConfigurationTests.cs | Switches to ThrowsExactly. |
| src/Microsoft.Performance.SDK.Tests/ProjectionTests.cs | Switches many throw-assertions to ThrowsExactly. |
| src/Microsoft.Performance.SDK.Tests/ProcessingSourceTests.cs | Switches to ThrowsExactly. |
| src/Microsoft.Performance.SDK.Tests/FileDataSourceAttributeTests.cs | Switches to ThrowsExactly. |
| src/Microsoft.Performance.SDK.Tests/ExtensionlessFileDataSourceAttributeTests.cs | Switches to ThrowsExactly. |
| src/Microsoft.Performance.SDK.Tests/DirectoryDataSourceAttributeTests.cs | Switches to ThrowsExactly. |
| src/Microsoft.Performance.SDK.Tests/DataSourceInfoTests.cs | Switches to ThrowsExactly (and retains duplicated asserts that should be cleaned up). |
| src/Microsoft.Performance.SDK.Tests/ColumnVariantsTests.cs | Switches to ThrowsExactly. |
| src/Microsoft.Performance.SDK.Tests/CollectionExtensionsTests.cs | Switches to ThrowsExactly. |
| src/Microsoft.Performance.SDK.Runtime.Tests/VersionCheckerTests.cs | Converts composite-format assert messages to interpolated strings. |
| src/Microsoft.Performance.SDK.Runtime.Tests/TableBuilderTests.cs | Switches to ThrowsExactly. |
| src/Microsoft.Performance.SDK.Runtime.Tests/ProcessingSourceReferenceTests.cs | Switches to ThrowsExactly. |
| src/Microsoft.Performance.SDK.Runtime.Tests/ProcessingSourceExecutorTests.cs | Switches to ThrowsExactly. |
| src/Microsoft.Performance.SDK.Runtime.Tests/Options/StreamPluginOptionsSaverTests.cs | Switches disposed-stream assertion to ThrowsExactly. |
| src/Microsoft.Performance.SDK.Runtime.Tests/Options/StreamPluginOptionsLoaderTests.cs | Switches disposed-stream assertion to ThrowsExactly. |
| src/Microsoft.Performance.SDK.Runtime.Tests/Options/PluginOptionsSystemTests.cs | Switches to ThrowsExactly (but current change introduces a mismatch for [DataRow(null)] and ignores filePath). |
| src/Microsoft.Performance.SDK.Runtime.Tests/Extensibility/TableExtensionReferenceTests.cs | Switches to ThrowsExactly. |
| src/Microsoft.Performance.SDK.Runtime.Tests/Extensibility/SourceSessionTests.cs | Switches to ThrowsExactly. |
| src/Microsoft.Performance.SDK.Runtime.Tests/Extensibility/SourceDataCookerReferenceTests.cs | Switches to ThrowsExactly (incl. commented-out assertions). |
| src/Microsoft.Performance.SDK.Runtime.Tests/Extensibility/DependencyDagTests.cs | Switches to ThrowsExactly. |
| src/Microsoft.Performance.SDK.Runtime.Tests/Extensibility/DependencyDagExtensionsTests.cs | Switches to ThrowsExactly. |
| src/Microsoft.Performance.SDK.Runtime.Tests/Extensibility/DataProcessorReferenceTests.cs | Switches commented-out assertions to ThrowsExactly. |
| src/Microsoft.Performance.SDK.Runtime.Tests/Extensibility/DataExtensionRetrievalFactoryTests.cs | Switches to ThrowsExactly. |
| src/Microsoft.Performance.SDK.Runtime.Tests/Extensibility/DataExtensionRepositoryTests.cs | Switches to ThrowsExactly (incl. commented-out assertions). |
| src/Microsoft.Performance.SDK.Runtime.Tests/Extensibility/DataExtensionDependencyTests.cs | Switches to ThrowsExactly. |
| src/Microsoft.Performance.SDK.Runtime.Tests/Extensibility/DataCookerSchedulingNodeTests.cs | Switches to ThrowsExactly. |
| src/Microsoft.Performance.SDK.Runtime.Tests/Extensibility/CompositeDataCookerReferenceTests.cs | Switches to ThrowsExactly (incl. commented-out assertions). |
| src/Microsoft.Performance.SDK.Runtime.Tests/Extensibility/CompositeCookerRepositoryTests.cs | Switches to ThrowsExactly. |
| src/Microsoft.Performance.SDK.Runtime.Tests/Discovery/AssemblyExtensionDiscoveryTests.cs | Switches to ThrowsExactly. |
| src/Microsoft.Performance.SDK.Runtime.Tests/DataSourceResolverTests.cs | Switches to ThrowsExactly and interpolated assert message. |
| src/Microsoft.Performance.SDK.Runtime.Tests/CookedDataReflectorTests.cs | Switches to ThrowsExactly. |
| src/Microsoft.Performance.SDK.Runtime.Tests/ColumnBuilding/ToggledColumnBuilderTests.cs | Switches to ThrowsExactly. |
| src/Microsoft.Performance.SDK.Runtime.Tests/ColumnBuilding/ModalColumnBuilderTests.cs | Switches to ThrowsExactly. |
| src/Microsoft.Performance.SDK.Runtime.Tests/ColumnBuilding/EmptyColumnBuilderTests.cs | Switches to ThrowsExactly. |
| src/Microsoft.Performance.SDK.Runtime.NetCoreApp.Tests/Plugins/PluginsLoaderTests.cs | Switches to ThrowsExactly/ThrowsExactlyAsync and interpolated assert messages. |
Review details
Comments suppressed due to low confidence (2)
src/Microsoft.Performance.SDK.Tests/DataSourceInfoTests.cs:28
- This test asserts the same
new DataSourceInfo(0, -1, DateTime.UnixEpoch)call twice, which is redundant and doesn’t increase coverage.
[TestMethod]
[UnitTest]
public void NegativeEndThrows()
{
Assert.ThrowsExactly<ArgumentOutOfRangeException>(() => new DataSourceInfo(0, -1, DateTime.UnixEpoch));
Assert.ThrowsExactly<ArgumentOutOfRangeException>(() => new DataSourceInfo(0, -1, DateTime.UnixEpoch));
}
src/Microsoft.Performance.SDK.Tests/DataSourceInfoTests.cs:36
- This test asserts the same
new DataSourceInfo(1, 0, DateTime.UnixEpoch)call twice, which is redundant and doesn’t increase coverage.
[TestMethod]
[UnitTest]
public void StopLessThanStartThrows()
{
Assert.ThrowsExactly<ArgumentOutOfRangeException>(() => new DataSourceInfo(1, 0, DateTime.UnixEpoch));
Assert.ThrowsExactly<ArgumentOutOfRangeException>(() => new DataSourceInfo(1, 0, DateTime.UnixEpoch));
}
- Files reviewed: 49/49 changed files
- Comments generated: 2
- Review effort level: Low
jmaxson-ms
approved these changes
Jul 29, 2026
helenkzhang
approved these changes
Jul 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
• Bump MSTest.TestAdapter / MSTest.TestFramework from 2.2.7 → 4.2.2 in Directory.Build.targets
• Bump Microsoft.NET.Test.Sdk from 16.11.0 → 18.5.1
• Update Microsoft.Performance.Toolkit.Plugins.Core.Tests.csproj and ...Plugins.Runtime.Tests.csproj to use centrally-managed package versions; bump Moq and coverlet.collector
• Replace all Assert.ThrowsException calls with Assert.ThrowsExactly
• Replace all Assert.ThrowsExceptionAsync calls with Assert.ThrowsExactlyAsync
• Convert composite-format assert messages ( "...{0}...", args ) to C#-interpolated strings across affected test files
• Fix AssertEx.IsInstanceOfType to use string.Format since the formatted-message overload was removed
• Add explicit generic type argument to the ambiguous Assert.AreNotSame call in ToolkitEngineTests.cs