Skip to content

Upgrade to MSTest4 - #438

Merged
xj-ms merged 2 commits into
mainfrom
user/jing/mstest4
Jul 29, 2026
Merged

Upgrade to MSTest4#438
xj-ms merged 2 commits into
mainfrom
user/jing/mstest4

Conversation

@xj-ms

@xj-ms xj-ms commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

• 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

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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* with Assert.ThrowsExactly* and modernizes assert messages to interpolated strings; adjusts AssertEx to 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

Comment thread src/Microsoft.Performance.SDK.Runtime.Tests/Options/PluginOptionsSystemTests.cs Outdated
Comment thread src/Microsoft.Performance.SDK.Tests/DataSourceInfoTests.cs
@xj-ms
xj-ms force-pushed the user/jing/mstest4 branch from b8a05e2 to 9c40955 Compare July 28, 2026 04:35
@xj-ms
xj-ms merged commit c297654 into main Jul 29, 2026
5 checks passed
@xj-ms
xj-ms deleted the user/jing/mstest4 branch July 29, 2026 19:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants