diff --git a/Directory.Build.targets b/Directory.Build.targets index 24cf690349..40981720ca 100644 --- a/Directory.Build.targets +++ b/Directory.Build.targets @@ -61,7 +61,6 @@ true - 3.9.3 3.9.3 - 1.0.3-preview 2.4.2 2.4.5 2.4.2 diff --git a/test/DataCollectors/Microsoft.TestPlatform.Extensions.EventLogCollector.UnitTests/Microsoft.TestPlatform.Extensions.EventLogCollector.UnitTests.csproj b/test/DataCollectors/Microsoft.TestPlatform.Extensions.EventLogCollector.UnitTests/Microsoft.TestPlatform.Extensions.EventLogCollector.UnitTests.csproj index 3d675a513f..d8d3e66ebf 100644 --- a/test/DataCollectors/Microsoft.TestPlatform.Extensions.EventLogCollector.UnitTests/Microsoft.TestPlatform.Extensions.EventLogCollector.UnitTests.csproj +++ b/test/DataCollectors/Microsoft.TestPlatform.Extensions.EventLogCollector.UnitTests/Microsoft.TestPlatform.Extensions.EventLogCollector.UnitTests.csproj @@ -20,6 +20,7 @@ + diff --git a/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/TestPluginDiscovererTests.cs b/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/TestPluginDiscovererTests.cs index 15fdc0702a..de46d6098c 100644 --- a/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/TestPluginDiscovererTests.cs +++ b/test/Microsoft.TestPlatform.Common.UnitTests/ExtensionFramework/TestPluginDiscovererTests.cs @@ -18,8 +18,6 @@ using Microsoft.VisualStudio.TestPlatform.ObjectModel.Logging; using Microsoft.VisualStudio.TestTools.UnitTesting; -using MSTest.TestFramework.AssertExtensions; - namespace TestPlatform.Common.UnitTests.ExtensionFramework; [TestClass] @@ -130,9 +128,9 @@ public void GetTestExtensionsInformationShouldNotAbortOnFaultyExtensions() typeof(TestPluginDiscovererTests).Assembly.Location, }; - var testExtensions = TestPluginDiscoverer.GetTestExtensionsInformation(pathToExtensions); + _ = TestPluginDiscoverer.GetTestExtensionsInformation(pathToExtensions); - Assert.That.DoesNotThrow(() => TestPluginDiscoverer.GetTestExtensionsInformation(pathToExtensions)); + _ = TestPluginDiscoverer.GetTestExtensionsInformation(pathToExtensions); } #region Implementations diff --git a/test/Microsoft.TestPlatform.ObjectModel.UnitTests/RunSettings/RunConfigurationTests.cs b/test/Microsoft.TestPlatform.ObjectModel.UnitTests/RunSettings/RunConfigurationTests.cs index c88336c737..8194ebae03 100644 --- a/test/Microsoft.TestPlatform.ObjectModel.UnitTests/RunSettings/RunConfigurationTests.cs +++ b/test/Microsoft.TestPlatform.ObjectModel.UnitTests/RunSettings/RunConfigurationTests.cs @@ -9,8 +9,6 @@ using Microsoft.VisualStudio.TestPlatform.PlatformAbstractions; using Microsoft.VisualStudio.TestTools.UnitTesting; -using MSTest.TestFramework.AssertExtensions; - namespace Microsoft.TestPlatform.ObjectModel.UnitTests; [TestClass] @@ -172,9 +170,9 @@ public void RunConfigurationFromXmlThrowsSettingsExceptionIfBatchSizeIsInvalid() "; - Assert.That.Throws( - () => XmlRunSettingsUtilities.GetRunConfigurationNode(settingsXml)) - .WithExactMessage("Invalid settings 'RunConfiguration'. Invalid value 'Foo' specified for 'BatchSize'."); + var exception = Assert.ThrowsExactly( + () => XmlRunSettingsUtilities.GetRunConfigurationNode(settingsXml)); + Assert.AreEqual("Invalid settings 'RunConfiguration'. Invalid value 'Foo' specified for 'BatchSize'.", exception.Message); } [TestMethod] @@ -189,9 +187,9 @@ public void RunConfigurationFromXmlThrowsSettingsExceptionIfTestSessionTimeoutIs "; - Assert.That.Throws( - () => XmlRunSettingsUtilities.GetRunConfigurationNode(settingsXml)) - .WithExactMessage("Invalid settings 'RunConfiguration'. Invalid value '-1' specified for 'TestSessionTimeout'."); + var exception = Assert.ThrowsExactly( + () => XmlRunSettingsUtilities.GetRunConfigurationNode(settingsXml)); + Assert.AreEqual("Invalid settings 'RunConfiguration'. Invalid value '-1' specified for 'TestSessionTimeout'.", exception.Message); } [TestMethod] @@ -221,9 +219,9 @@ public void RunConfigurationFromXmlThrowsSettingsExceptionIfExecutionThreadApart "; - Assert.That.Throws( - () => XmlRunSettingsUtilities.GetRunConfigurationNode(settingsXml)) - .WithExactMessage("Invalid settings 'RunConfiguration'. Invalid value 'RandomValue' specified for 'ExecutionThreadApartmentState'."); + var exception = Assert.ThrowsExactly( + () => XmlRunSettingsUtilities.GetRunConfigurationNode(settingsXml)); + Assert.AreEqual("Invalid settings 'RunConfiguration'. Invalid value 'RandomValue' specified for 'ExecutionThreadApartmentState'.", exception.Message); } [TestMethod] @@ -237,9 +235,9 @@ public void RunConfigurationFromXmlThrowsSettingsExceptionIfBatchSizeIsNegativeI "; - Assert.That.Throws( - () => XmlRunSettingsUtilities.GetRunConfigurationNode(settingsXml)) - .WithExactMessage("Invalid settings 'RunConfiguration'. Invalid value '-10' specified for 'BatchSize'."); + var exception = Assert.ThrowsExactly( + () => XmlRunSettingsUtilities.GetRunConfigurationNode(settingsXml)); + Assert.AreEqual("Invalid settings 'RunConfiguration'. Invalid value '-10' specified for 'BatchSize'.", exception.Message); } [DataRow(true)] @@ -348,8 +346,8 @@ public void RunConfigurationShouldThrowSettingsExceptionIfResultsirectoryIsEmpty "; - Assert.That.Throws( - () => XmlRunSettingsUtilities.GetRunConfigurationNode(settingsXml)) - .WithExactMessage("Invalid settings 'RunConfiguration'. Invalid value '' specified for 'ResultsDirectory'."); + var exception = Assert.ThrowsExactly( + () => XmlRunSettingsUtilities.GetRunConfigurationNode(settingsXml)); + Assert.AreEqual("Invalid settings 'RunConfiguration'. Invalid value '' specified for 'ResultsDirectory'.", exception.Message); } } diff --git a/test/Microsoft.TestPlatform.Utilities.UnitTests/InferRunSettingsHelperTests.cs b/test/Microsoft.TestPlatform.Utilities.UnitTests/InferRunSettingsHelperTests.cs index 897c96c87d..d5c1de85a1 100644 --- a/test/Microsoft.TestPlatform.Utilities.UnitTests/InferRunSettingsHelperTests.cs +++ b/test/Microsoft.TestPlatform.Utilities.UnitTests/InferRunSettingsHelperTests.cs @@ -12,8 +12,6 @@ using Microsoft.VisualStudio.TestPlatform.Utilities; using Microsoft.VisualStudio.TestTools.UnitTesting; -using MSTest.TestFramework.AssertExtensions; - using OMResources = Microsoft.VisualStudio.TestPlatform.ObjectModel.Resources.CommonResources; namespace Microsoft.TestPlatform.Utilities.UnitTests; @@ -42,8 +40,8 @@ public void UpdateRunSettingsShouldThrowIfRunSettingsNodeDoesNotExist() Action action = () => InferRunSettingsHelper.UpdateRunSettingsWithUserProvidedSwitches(xmlDocument, Architecture.X86, Framework.DefaultFramework, "temp"); - Assert.That.Throws(action) - .WithMessage("An error occurred while loading the settings. Error: Could not find 'RunSettings' node.."); + var exception = Assert.ThrowsExactly(action); + Assert.AreEqual("An error occurred while loading the settings. Error: Could not find 'RunSettings' node..", exception.Message); } [TestMethod] @@ -54,8 +52,8 @@ public void UpdateRunSettingsShouldThrowIfPlatformNodeIsInvalid() Action action = () => InferRunSettingsHelper.UpdateRunSettingsWithUserProvidedSwitches(xmlDocument, Architecture.X86, Framework.DefaultFramework, "temp"); - Assert.That.Throws(action) - .WithMessage("An error occurred while loading the settings. Error: Invalid setting 'RunConfiguration'. Invalid value 'foo' specified for 'TargetPlatform'."); + var exception = Assert.ThrowsExactly(action); + Assert.AreEqual("An error occurred while loading the settings. Error: Invalid setting 'RunConfiguration'. Invalid value 'foo' specified for 'TargetPlatform'..", exception.Message); } [TestMethod] @@ -66,8 +64,8 @@ public void UpdateRunSettingsShouldThrowIfFrameworkNodeIsInvalid() Action action = () => InferRunSettingsHelper.UpdateRunSettingsWithUserProvidedSwitches(xmlDocument, Architecture.X86, Framework.DefaultFramework, "temp"); - Assert.That.Throws(action) - .WithMessage("An error occurred while loading the settings. Error: Invalid setting 'RunConfiguration'. Invalid value 'foo' specified for 'TargetFrameworkVersion'."); + var exception = Assert.ThrowsExactly(action); + Assert.AreEqual("An error occurred while loading the settings. Error: Invalid setting 'RunConfiguration'. Invalid value 'foo' specified for 'TargetFrameworkVersion'..", exception.Message); } [TestMethod] diff --git a/test/Microsoft.TestPlatform.Utilities.UnitTests/MSTestSettingsUtilitiesTests.cs b/test/Microsoft.TestPlatform.Utilities.UnitTests/MSTestSettingsUtilitiesTests.cs index 7b5e257b1d..d7b3e8baf0 100644 --- a/test/Microsoft.TestPlatform.Utilities.UnitTests/MSTestSettingsUtilitiesTests.cs +++ b/test/Microsoft.TestPlatform.Utilities.UnitTests/MSTestSettingsUtilitiesTests.cs @@ -7,8 +7,6 @@ using Microsoft.VisualStudio.TestPlatform.Utilities; using Microsoft.VisualStudio.TestTools.UnitTesting; -using MSTest.TestFramework.AssertExtensions; - namespace Microsoft.TestPlatform.Utilities.Tests; [TestClass] @@ -50,7 +48,8 @@ public void ImportShouldThrowIfNotLegacySettingsFile() MSTestSettingsUtilities.Import( "C:\\temp\\r.runsettings", xmlDocument); - Assert.That.Throws(action).WithMessage("Unexpected settings file specified."); + var exception = Assert.ThrowsExactly(action); + Assert.AreEqual("Unexpected settings file specified.", exception.Message); } [TestMethod] @@ -65,7 +64,8 @@ public void ImportShouldThrowIfDefaultRunSettingsIsIncorrect() MSTestSettingsUtilities.Import( "C:\\temp\\r.testsettings", xmlDocument); - Assert.That.Throws(action).WithMessage("Could not find 'RunSettings' node."); + var exception = Assert.ThrowsExactly(action); + Assert.AreEqual("Could not find 'RunSettings' node.", exception.Message); } [TestMethod] diff --git a/test/SettingsMigrator.UnitTests/SettingsMigrator.UnitTests.csproj b/test/SettingsMigrator.UnitTests/SettingsMigrator.UnitTests.csproj index 6091565488..03f7b9ec40 100644 --- a/test/SettingsMigrator.UnitTests/SettingsMigrator.UnitTests.csproj +++ b/test/SettingsMigrator.UnitTests/SettingsMigrator.UnitTests.csproj @@ -15,6 +15,7 @@ +