From 740474b586cfbcd78fe0c2afd59fd2ed5d97c7a8 Mon Sep 17 00:00:00 2001 From: jagarg Date: Tue, 18 Dec 2018 15:54:13 +0530 Subject: [PATCH 1/6] Correcting error message when dynamic data doen't have any data --- .../Attributes/DynamicDataAttribute.cs | 3 +- .../Attributes/DynamicDataAttributeTests.cs | 37 ++++++++++++++++++- 2 files changed, 37 insertions(+), 3 deletions(-) diff --git a/src/TestFramework/MSTest.Core/Attributes/DynamicDataAttribute.cs b/src/TestFramework/MSTest.Core/Attributes/DynamicDataAttribute.cs index 16982f539e..ed07d74866 100644 --- a/src/TestFramework/MSTest.Core/Attributes/DynamicDataAttribute.cs +++ b/src/TestFramework/MSTest.Core/Attributes/DynamicDataAttribute.cs @@ -128,7 +128,8 @@ public IEnumerable GetData(MethodInfo methodInfo) } IEnumerable enumerable = obj as IEnumerable; - if (enumerable == null) + + if (enumerable == null || !enumerable.Any()) { throw new ArgumentNullException( string.Format( diff --git a/test/UnitTests/MSTest.Core.Unit.Tests/Attributes/DynamicDataAttributeTests.cs b/test/UnitTests/MSTest.Core.Unit.Tests/Attributes/DynamicDataAttributeTests.cs index 164ef58119..2d7b2876c2 100644 --- a/test/UnitTests/MSTest.Core.Unit.Tests/Attributes/DynamicDataAttributeTests.cs +++ b/test/UnitTests/MSTest.Core.Unit.Tests/Attributes/DynamicDataAttributeTests.cs @@ -99,6 +99,19 @@ public void GetDataShouldThrowExceptionIfPropertyReturnsNull() ActionUtility.ActionShouldThrowExceptionOfType(action, typeof(ArgumentNullException)); } + [TestFrameworkV1.TestMethod] + public void GetDataShouldThrowExceptionIfPropertyReturnsEmpty() + { + Action action = () => + { + var methodInfo = this.dummyTestClass.GetType().GetTypeInfo().GetDeclaredMethod("TestMethod5"); + this.dynamicDataAttribute = new DynamicDataAttribute("EmptyProperty", typeof(DummyTestClass)); + this.dynamicDataAttribute.GetData(methodInfo); + }; + + ActionUtility.ActionShouldThrowExceptionOfType(action, typeof(ArgumentNullException)); + } + [TestFrameworkV1.TestMethod] public void GetDataShouldThrowExceptionIfPropertyDoesNotReturnCorrectType() { @@ -282,7 +295,7 @@ public static IEnumerable ReusableTestDataProperty } /// - /// Gets the reusable test data property. + /// Gets the null test data property. /// public static IEnumerable NullProperty { @@ -293,7 +306,18 @@ public static IEnumerable NullProperty } /// - /// Gets the reusable test data property. + /// Gets the empty test data property. + /// + public static IEnumerable EmptyProperty + { + get + { + return new object[][] { }; + } + } + + /// + /// Gets the wrong test data property. /// public static IEnumerable WrongDataTypeProperty { @@ -437,6 +461,15 @@ public void TestMethod4() { } + /// + /// The test method 5. + /// + [FrameworkV2::Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute] + [DynamicData("EmptyProperty")] + public void TestMethod5() + { + } + /// /// DataRow test method 1. /// From 0fef58ca7f5f2531c421ad6abe978ed5ffb8a6fe Mon Sep 17 00:00:00 2001 From: jagarg Date: Mon, 18 Nov 2019 16:53:17 +0530 Subject: [PATCH 2/6] Configuring child domain's appbase to be test source location --- .../Discovery/AssemblyEnumeratorWrapper.cs | 3 - .../Execution/TestAssemblySettingsProvider.cs | 2 +- .../Execution/TestExecutionManager.cs | 9 +-- .../Services/DesktopTestSourceHost.cs | 25 ++------ .../ITestSourceHost.cs | 5 -- .../Services/NetCoreTestSourceHost.cs | 8 --- .../Services/ns10TestSourceHost.cs | 8 --- .../Services/DesktopTestSourceHostTests.cs | 64 +------------------ 8 files changed, 12 insertions(+), 112 deletions(-) diff --git a/src/Adapter/MSTest.CoreAdapter/Discovery/AssemblyEnumeratorWrapper.cs b/src/Adapter/MSTest.CoreAdapter/Discovery/AssemblyEnumeratorWrapper.cs index 76de782081..b99e7dd789 100644 --- a/src/Adapter/MSTest.CoreAdapter/Discovery/AssemblyEnumeratorWrapper.cs +++ b/src/Adapter/MSTest.CoreAdapter/Discovery/AssemblyEnumeratorWrapper.cs @@ -144,9 +144,6 @@ private ICollection GetTestsInIsolation(string fullFilePath, IR var assemblyEnumerator = isolationHost.CreateInstanceForType( typeof(AssemblyEnumerator), new object[] { MSTestSettings.CurrentSettings }) as AssemblyEnumerator; - // After loading adapter reset the child-domain's appbase to point to test source location - isolationHost.UpdateAppBaseToTestSourceLocation(); - return assemblyEnumerator.EnumerateAssembly(fullFilePath, out warnings); } } diff --git a/src/Adapter/MSTest.CoreAdapter/Execution/TestAssemblySettingsProvider.cs b/src/Adapter/MSTest.CoreAdapter/Execution/TestAssemblySettingsProvider.cs index a5d904d53c..e7890b02e3 100644 --- a/src/Adapter/MSTest.CoreAdapter/Execution/TestAssemblySettingsProvider.cs +++ b/src/Adapter/MSTest.CoreAdapter/Execution/TestAssemblySettingsProvider.cs @@ -39,7 +39,7 @@ internal TestAssemblySettings GetSettings(string source) var testAssemblySettings = new TestAssemblySettings(); // Load the source. - var testAssembly = PlatformServiceProvider.Instance.FileOperations.LoadAssembly(source, isReflectionOnly: false); + var testAssembly = PlatformServiceProvider.Instance.FileOperations.LoadAssembly(source, isReflectionOnly: true); var parallelizeAttribute = this.reflectHelper.GetParallelizeAttribute(testAssembly); diff --git a/src/Adapter/MSTest.CoreAdapter/Execution/TestExecutionManager.cs b/src/Adapter/MSTest.CoreAdapter/Execution/TestExecutionManager.cs index c44f9af324..e4a444751d 100644 --- a/src/Adapter/MSTest.CoreAdapter/Execution/TestExecutionManager.cs +++ b/src/Adapter/MSTest.CoreAdapter/Execution/TestExecutionManager.cs @@ -215,6 +215,7 @@ private void ExecuteTestsInSource(IEnumerable tests, IRunContext runCo source = Path.Combine(PlatformServiceProvider.Instance.TestDeployment.GetDeploymentDirectory(), Path.GetFileName(source)); } + System.Diagnostics.Debugger.Launch(); using (var isolationHost = PlatformServiceProvider.Instance.CreateTestSourceHost(source, runContext?.RunSettings, frameworkHandle)) { // Create an instance of a type defined in adapter so that adapter gets loaded in the child app domain @@ -222,9 +223,6 @@ private void ExecuteTestsInSource(IEnumerable tests, IRunContext runCo typeof(UnitTestRunner), new object[] { MSTestSettings.CurrentSettings }) as UnitTestRunner; - // After loading adapter reset the chils-domain's appbase to point to test source location - isolationHost.UpdateAppBaseToTestSourceLocation(); - PlatformServiceProvider.Instance.AdapterTraceLogger.LogInfo("Created unit-test runner {0}", source); // Default test set is filtered tests based on user provided filter criteria @@ -247,10 +245,7 @@ private void ExecuteTestsInSource(IEnumerable tests, IRunContext runCo sourceLevelParameters = sourceLevelParameters.Concat(this.sessionParameters).ToDictionary(x => x.Key, x => x.Value); } - var sourceSettingsProvider = isolationHost.CreateInstanceForType( - typeof(TestAssemblySettingsProvider), - null) as TestAssemblySettingsProvider; - + var sourceSettingsProvider = new TestAssemblySettingsProvider(); var sourceSettings = sourceSettingsProvider.GetSettings(source); var parallelWorkers = sourceSettings.Workers; var parallelScope = sourceSettings.Scope; diff --git a/src/Adapter/PlatformServices.Desktop/Services/DesktopTestSourceHost.cs b/src/Adapter/PlatformServices.Desktop/Services/DesktopTestSourceHost.cs index 205955f374..a7b346f89e 100644 --- a/src/Adapter/PlatformServices.Desktop/Services/DesktopTestSourceHost.cs +++ b/src/Adapter/PlatformServices.Desktop/Services/DesktopTestSourceHost.cs @@ -64,7 +64,6 @@ internal TestSourceHost(string sourceFileName, IRunSettings runSettings, IFramew this.sourceFileName = sourceFileName; this.runSettings = runSettings; this.frameworkHandle = frameworkHandle; - this.appDomain = appDomain; // Set the environment context. @@ -87,6 +86,7 @@ internal AppDomain AppDomain /// public void SetupHost() { + System.Diagnostics.Debugger.Launch(); List resolutionPaths = this.GetResolutionPaths(this.sourceFileName, VSInstallationUtilities.IsCurrentProcessRunningInPortableMode()); if (EqtTrace.IsInfoEnabled) @@ -109,10 +109,7 @@ public void SetupHost() this.targetFrameworkVersion = this.GetTargetFrameworkVersionString(this.sourceFileName); AppDomainUtilities.SetAppDomainFrameworkVersionBasedOnTestSource(appDomainSetup, this.targetFrameworkVersion); - // Temporarily set appbase to the location from where adapter should be picked up from. We will later reset this to test source location - // once adapter gets loaded in the child app domain. - appDomainSetup.ApplicationBase = Path.GetDirectoryName(typeof(TestSourceHost).Assembly.Location); - + appDomainSetup.ApplicationBase = this.GetAppBaseAsPerPlatform(); var configFile = this.GetConfigFileForTestSource(this.sourceFileName); AppDomainUtilities.SetConfigurationFile(appDomainSetup, configFile); @@ -214,17 +211,11 @@ public void Dispose() } /// - /// Updates child-domain's appbase to point to test source location. + /// Gets child-domain's appbase to point to appropriate location. /// - public void UpdateAppBaseToTestSourceLocation() + /// Appbase path that should be set for child appdomain + internal string GetAppBaseAsPerPlatform() { - // Simply return if no child-appdomain was created - if (this.isAppDomainCreationDisabled) - { - return; - } - - // After adapter has been loaded, reset child-appdomains appbase. // The below logic of preferential setting the appdomains appbase is needed because: // 1. We set this to the location of the test source if it is built for Full CLR -> Ideally this needs to be done in all situations. // 2. We set this to the location where the current adapter is being picked up from for UWP and .Net Core scenarios -> This needs to be @@ -234,14 +225,12 @@ public void UpdateAppBaseToTestSourceLocation() // there would be a mismatch of platform service assemblies during discovery. if (this.targetFrameworkVersion.Contains(PlatformServices.Constants.DotNetFrameWorkStringPrefix)) { - this.domain.SetData("APPBASE", Path.GetDirectoryName(this.sourceFileName) ?? Path.GetDirectoryName(typeof(TestSourceHost).Assembly.Location)); + return Path.GetDirectoryName(this.sourceFileName) ?? Path.GetDirectoryName(typeof(TestSourceHost).Assembly.Location); } else { - this.domain.SetData("APPBASE", Path.GetDirectoryName(typeof(TestSourceHost).Assembly.Location)); + return Path.GetDirectoryName(typeof(TestSourceHost).Assembly.Location); } - - EqtTrace.Info("DesktopTestSourceHost.UpdateAppBaseToTestSourceLocation(): Updating domain's appbase path for source {0} to {1}.", this.sourceFileName, this.domain.SetupInformation.ApplicationBase); } /// diff --git a/src/Adapter/PlatformServices.Interface/ITestSourceHost.cs b/src/Adapter/PlatformServices.Interface/ITestSourceHost.cs index 6875bca5b8..f404a05d9c 100644 --- a/src/Adapter/PlatformServices.Interface/ITestSourceHost.cs +++ b/src/Adapter/PlatformServices.Interface/ITestSourceHost.cs @@ -27,10 +27,5 @@ public interface ITestSourceHost : IDisposable /// An instance of the type created in the host. /// If a type is to be created in isolation then it needs to be a MarshalByRefObject. object CreateInstanceForType(Type type, object[] args); - - /// - /// Updates child-domain's appbase to point to test source location - /// - void UpdateAppBaseToTestSourceLocation(); } } diff --git a/src/Adapter/PlatformServices.NetCore/Services/NetCoreTestSourceHost.cs b/src/Adapter/PlatformServices.NetCore/Services/NetCoreTestSourceHost.cs index bde6958a33..453d1ec797 100644 --- a/src/Adapter/PlatformServices.NetCore/Services/NetCoreTestSourceHost.cs +++ b/src/Adapter/PlatformServices.NetCore/Services/NetCoreTestSourceHost.cs @@ -64,14 +64,6 @@ public object CreateInstanceForType(Type type, object[] args) return Activator.CreateInstance(type, args); } - /// - /// Updates child-domain's appbase to point to test source location - /// - public void UpdateAppBaseToTestSourceLocation() - { - // Do nothing. - } - /// /// Sets context required for running tests. /// diff --git a/src/Adapter/PlatformServices.Shared/netstandard1.0/Services/ns10TestSourceHost.cs b/src/Adapter/PlatformServices.Shared/netstandard1.0/Services/ns10TestSourceHost.cs index 4deeb0da2c..5967600f70 100644 --- a/src/Adapter/PlatformServices.Shared/netstandard1.0/Services/ns10TestSourceHost.cs +++ b/src/Adapter/PlatformServices.Shared/netstandard1.0/Services/ns10TestSourceHost.cs @@ -53,14 +53,6 @@ public void Dispose() { // Do nothing. } - - /// - /// Updates child-domain's appbase to point to test source location - /// - public void UpdateAppBaseToTestSourceLocation() - { - // Do nothing. - } } #pragma warning restore SA1649 // SA1649FileNameMustMatchTypeName diff --git a/test/UnitTests/PlatformServices.Desktop.Unit.Tests/Services/DesktopTestSourceHostTests.cs b/test/UnitTests/PlatformServices.Desktop.Unit.Tests/Services/DesktopTestSourceHostTests.cs index 22af3fe0d8..1a60530989 100644 --- a/test/UnitTests/PlatformServices.Desktop.Unit.Tests/Services/DesktopTestSourceHostTests.cs +++ b/test/UnitTests/PlatformServices.Desktop.Unit.Tests/Services/DesktopTestSourceHostTests.cs @@ -106,7 +106,7 @@ public void CreateInstanceForTypeShouldCreateTheTypeInANewAppDomain() } [TestMethod] - public void SetupHostShouldSetChildDomainsAppBaseToAdapterLocation() + public void SetupHostShouldSetChildDomainsAppBaseToTestSourceLocation() { // Arrange DummyClass dummyclass = new DummyClass(); @@ -121,7 +121,7 @@ public void SetupHostShouldSetChildDomainsAppBaseToAdapterLocation() var expectedObject = sourceHost.Object.CreateInstanceForType(typeof(DummyClass), null) as DummyClass; // Assert - Assert.AreEqual(Path.GetDirectoryName(location), expectedObject.AppDomainAppBase); + Assert.AreEqual(Path.GetDirectoryName(typeof(DesktopTestSourceHostTests).Assembly.Location), expectedObject.AppDomainAppBase); } finally { @@ -185,66 +185,6 @@ public void SetupHostShouldSetResolutionsPaths() } } - /// - /// This test should ideally be choosing a different path for the test source. Currently both the test source and the adapter - /// are in the same location. However when we move to run these tests with the V2 itself, then this would be valid. - /// Leaving the test running till then. - /// - [TestMethod] - public void UpdateAppBaseToTestSourceLocationShouldSetDomainsAppBaseToTestSourceLocationForFullCLRTestss() - { - // Arrange - DummyClass dummyclass = new DummyClass(); - - var location = typeof(DesktopTestSourceHostTests).Assembly.Location; - var sourceHost = new Mock(location, null, null) { CallBase = true }; - try - { - sourceHost.Setup(tsh => tsh.GetTargetFrameworkVersionString(location)) - .Returns(".NETFramework,Version=v4.5.1"); - - // Act - sourceHost.Object.SetupHost(); - var expectedObject = - sourceHost.Object.CreateInstanceForType(typeof(DummyClass), null) as DummyClass; - sourceHost.Object.UpdateAppBaseToTestSourceLocation(); - - // Assert - Assert.AreEqual(Path.GetDirectoryName(location), expectedObject.AppDomainAppBase); - } - finally - { - sourceHost.Object.Dispose(); - } - } - - [TestMethod] - public void UpdateAppBaseToTestSourceLocationShouldSetDomainsAppBaseToAdaptersLocationForNonFullCLRTests() - { - // Arrange - DummyClass dummyclass = new DummyClass(); - - var location = typeof(TestSourceHost).Assembly.Location; - Mock sourceHost = new Mock(location, null, null) { CallBase = true }; - - try - { - sourceHost.Setup(tsh => tsh.GetTargetFrameworkVersionString(location)).Returns(".NETCore,Version=v5.0"); - - // Act - sourceHost.Object.SetupHost(); - var expectedObject = sourceHost.Object.CreateInstanceForType(typeof(DummyClass), null) as DummyClass; - sourceHost.Object.UpdateAppBaseToTestSourceLocation(); - - // Assert - Assert.AreEqual(Path.GetDirectoryName(location), expectedObject.AppDomainAppBase); - } - finally - { - sourceHost.Object.Dispose(); - } - } - [TestMethod] public void DisposeShouldSetTestHostShutdownOnIssueWithAppDomainUnload() { From 36d39bc1e15987fe708f0fd86f7d60eb6fef5523 Mon Sep 17 00:00:00 2001 From: jagarg Date: Mon, 18 Nov 2019 16:55:44 +0530 Subject: [PATCH 3/6] Nit --- src/Adapter/MSTest.CoreAdapter/Execution/TestExecutionManager.cs | 1 - .../PlatformServices.Desktop/Services/DesktopTestSourceHost.cs | 1 - 2 files changed, 2 deletions(-) diff --git a/src/Adapter/MSTest.CoreAdapter/Execution/TestExecutionManager.cs b/src/Adapter/MSTest.CoreAdapter/Execution/TestExecutionManager.cs index e4a444751d..2cf9050e16 100644 --- a/src/Adapter/MSTest.CoreAdapter/Execution/TestExecutionManager.cs +++ b/src/Adapter/MSTest.CoreAdapter/Execution/TestExecutionManager.cs @@ -215,7 +215,6 @@ private void ExecuteTestsInSource(IEnumerable tests, IRunContext runCo source = Path.Combine(PlatformServiceProvider.Instance.TestDeployment.GetDeploymentDirectory(), Path.GetFileName(source)); } - System.Diagnostics.Debugger.Launch(); using (var isolationHost = PlatformServiceProvider.Instance.CreateTestSourceHost(source, runContext?.RunSettings, frameworkHandle)) { // Create an instance of a type defined in adapter so that adapter gets loaded in the child app domain diff --git a/src/Adapter/PlatformServices.Desktop/Services/DesktopTestSourceHost.cs b/src/Adapter/PlatformServices.Desktop/Services/DesktopTestSourceHost.cs index a7b346f89e..8bb64e98c1 100644 --- a/src/Adapter/PlatformServices.Desktop/Services/DesktopTestSourceHost.cs +++ b/src/Adapter/PlatformServices.Desktop/Services/DesktopTestSourceHost.cs @@ -86,7 +86,6 @@ internal AppDomain AppDomain /// public void SetupHost() { - System.Diagnostics.Debugger.Launch(); List resolutionPaths = this.GetResolutionPaths(this.sourceFileName, VSInstallationUtilities.IsCurrentProcessRunningInPortableMode()); if (EqtTrace.IsInfoEnabled) From 752baab03a51a091a72b3551e282f8d8fd3d90c2 Mon Sep 17 00:00:00 2001 From: jagarg Date: Mon, 25 Nov 2019 20:17:59 +0530 Subject: [PATCH 4/6] Catch typeload exception if TestAssemblySettingsProvider doesn't exist --- .../Execution/TestAssemblySettingsProvider.cs | 2 +- .../Execution/TestExecutionManager.cs | 27 +++++++++++++++++-- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/src/Adapter/MSTest.CoreAdapter/Execution/TestAssemblySettingsProvider.cs b/src/Adapter/MSTest.CoreAdapter/Execution/TestAssemblySettingsProvider.cs index e7890b02e3..a5d904d53c 100644 --- a/src/Adapter/MSTest.CoreAdapter/Execution/TestAssemblySettingsProvider.cs +++ b/src/Adapter/MSTest.CoreAdapter/Execution/TestAssemblySettingsProvider.cs @@ -39,7 +39,7 @@ internal TestAssemblySettings GetSettings(string source) var testAssemblySettings = new TestAssemblySettings(); // Load the source. - var testAssembly = PlatformServiceProvider.Instance.FileOperations.LoadAssembly(source, isReflectionOnly: true); + var testAssembly = PlatformServiceProvider.Instance.FileOperations.LoadAssembly(source, isReflectionOnly: false); var parallelizeAttribute = this.reflectHelper.GetParallelizeAttribute(testAssembly); diff --git a/src/Adapter/MSTest.CoreAdapter/Execution/TestExecutionManager.cs b/src/Adapter/MSTest.CoreAdapter/Execution/TestExecutionManager.cs index 2cf9050e16..c19036e483 100644 --- a/src/Adapter/MSTest.CoreAdapter/Execution/TestExecutionManager.cs +++ b/src/Adapter/MSTest.CoreAdapter/Execution/TestExecutionManager.cs @@ -244,8 +244,31 @@ private void ExecuteTestsInSource(IEnumerable tests, IRunContext runCo sourceLevelParameters = sourceLevelParameters.Concat(this.sessionParameters).ToDictionary(x => x.Key, x => x.Value); } - var sourceSettingsProvider = new TestAssemblySettingsProvider(); - var sourceSettings = sourceSettingsProvider.GetSettings(source); + TestAssemblySettingsProvider sourceSettingsProvider = null; + + try + { + sourceSettingsProvider = isolationHost.CreateInstanceForType( + typeof(TestAssemblySettingsProvider), + null) as TestAssemblySettingsProvider; + } + catch (TypeLoadException ex) + { + PlatformServiceProvider.Instance.AdapterTraceLogger.LogInfo( + "Could not create TestAssemblySettingsProvider instance in child app-domain", + ex); + } + + TestAssemblySettings sourceSettings; + if (sourceSettingsProvider != null) + { + sourceSettings = sourceSettingsProvider.GetSettings(source); + } + else + { + sourceSettings = new TestAssemblySettings(); + } + var parallelWorkers = sourceSettings.Workers; var parallelScope = sourceSettings.Scope; From 6fc051c9703afff08887f8f9e2290602e5b85c30 Mon Sep 17 00:00:00 2001 From: jagarg Date: Tue, 26 Nov 2019 16:37:20 +0530 Subject: [PATCH 5/6] PR comments --- .../MSTest.CoreAdapter/Execution/TestExecutionManager.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Adapter/MSTest.CoreAdapter/Execution/TestExecutionManager.cs b/src/Adapter/MSTest.CoreAdapter/Execution/TestExecutionManager.cs index c19036e483..39eab01ec7 100644 --- a/src/Adapter/MSTest.CoreAdapter/Execution/TestExecutionManager.cs +++ b/src/Adapter/MSTest.CoreAdapter/Execution/TestExecutionManager.cs @@ -252,7 +252,7 @@ private void ExecuteTestsInSource(IEnumerable tests, IRunContext runCo typeof(TestAssemblySettingsProvider), null) as TestAssemblySettingsProvider; } - catch (TypeLoadException ex) + catch (Exception ex) { PlatformServiceProvider.Instance.AdapterTraceLogger.LogInfo( "Could not create TestAssemblySettingsProvider instance in child app-domain", From b0f5851b55add8b06c9bf901374c7118ee0a64bc Mon Sep 17 00:00:00 2001 From: jagarg Date: Tue, 26 Nov 2019 16:42:12 +0530 Subject: [PATCH 6/6] Nit --- .../Execution/TestExecutionManager.cs | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/src/Adapter/MSTest.CoreAdapter/Execution/TestExecutionManager.cs b/src/Adapter/MSTest.CoreAdapter/Execution/TestExecutionManager.cs index 39eab01ec7..d7f27bc823 100644 --- a/src/Adapter/MSTest.CoreAdapter/Execution/TestExecutionManager.cs +++ b/src/Adapter/MSTest.CoreAdapter/Execution/TestExecutionManager.cs @@ -259,16 +259,7 @@ private void ExecuteTestsInSource(IEnumerable tests, IRunContext runCo ex); } - TestAssemblySettings sourceSettings; - if (sourceSettingsProvider != null) - { - sourceSettings = sourceSettingsProvider.GetSettings(source); - } - else - { - sourceSettings = new TestAssemblySettings(); - } - + var sourceSettings = (sourceSettingsProvider != null) ? sourceSettingsProvider.GetSettings(source) : new TestAssemblySettings(); var parallelWorkers = sourceSettings.Workers; var parallelScope = sourceSettings.Scope;