From 23321d75d1ad3c27f69be2a0c204dbc2136fe8b3 Mon Sep 17 00:00:00 2001 From: Youssef Victor Date: Wed, 11 Dec 2024 12:19:20 +0100 Subject: [PATCH] [Refactor] Use `List` rather than `Collection` (#4315) --- .../Discovery/AssemblyEnumerator.cs | 11 ++--- .../Discovery/AssemblyEnumeratorWrapper.cs | 8 ++-- .../Discovery/TypeEnumerator.cs | 20 ++++---- .../Discovery/TypeValidator.cs | 2 +- .../Discovery/UnitTestDiscoverer.cs | 2 +- .../Discovery/AssemblyEnumeratorTests.cs | 47 ++++++++++--------- .../AssemblyEnumeratorWrapperTests.cs | 2 +- .../Discovery/TypeEnumeratorTests.cs | 24 +++++----- 8 files changed, 55 insertions(+), 61 deletions(-) diff --git a/src/Adapter/MSTest.TestAdapter/Discovery/AssemblyEnumerator.cs b/src/Adapter/MSTest.TestAdapter/Discovery/AssemblyEnumerator.cs index 5a1ea2adae..dc95277fea 100644 --- a/src/Adapter/MSTest.TestAdapter/Discovery/AssemblyEnumerator.cs +++ b/src/Adapter/MSTest.TestAdapter/Discovery/AssemblyEnumerator.cs @@ -72,17 +72,16 @@ public AssemblyEnumerator(MSTestSettings settings) => internal ICollection EnumerateAssembly( string assemblyFileName, [StringSyntax(StringSyntaxAttribute.Xml, nameof(runSettingsXml))] string? runSettingsXml, - out ICollection warnings) + List warnings) { DebugEx.Assert(!StringEx.IsNullOrWhiteSpace(assemblyFileName), "Invalid assembly file name."); - var warningMessages = new List(); var tests = new List(); // Contains list of assembly/class names for which we have already added fixture tests. var fixturesTests = new HashSet(); Assembly assembly = PlatformServiceProvider.Instance.FileOperations.LoadAssembly(assemblyFileName, isReflectionOnly: false); - Type[] types = GetTypes(assembly, assemblyFileName, warningMessages); + Type[] types = GetTypes(assembly, assemblyFileName, warnings); bool discoverInternals = ReflectHelper.GetDiscoverInternalsAttribute(assembly) != null; TestIdGenerationStrategy testIdGenerationStrategy = ReflectHelper.GetTestIdGenerationStrategy(assembly); @@ -109,12 +108,11 @@ internal ICollection EnumerateAssembly( continue; } - List testsInType = DiscoverTestsInType(assemblyFileName, testRunParametersFromRunSettings, type, warningMessages, discoverInternals, + List testsInType = DiscoverTestsInType(assemblyFileName, testRunParametersFromRunSettings, type, warnings, discoverInternals, testDataSourceDiscovery, testIdGenerationStrategy, fixturesTests); tests.AddRange(testsInType); } - warnings = warningMessages; return tests; } @@ -228,8 +226,7 @@ private List DiscoverTestsInType( { typeFullName = type.FullName; TypeEnumerator testTypeEnumerator = GetTypeEnumerator(type, assemblyFileName, discoverInternals, discoveryOption, testIdGenerationStrategy); - ICollection? unitTestCases = testTypeEnumerator.Enumerate(out ICollection warningsFromTypeEnumerator); - warningMessages.AddRange(warningsFromTypeEnumerator); + List? unitTestCases = testTypeEnumerator.Enumerate(warningMessages); if (unitTestCases != null) { diff --git a/src/Adapter/MSTest.TestAdapter/Discovery/AssemblyEnumeratorWrapper.cs b/src/Adapter/MSTest.TestAdapter/Discovery/AssemblyEnumeratorWrapper.cs index cc81800eeb..84fd028284 100644 --- a/src/Adapter/MSTest.TestAdapter/Discovery/AssemblyEnumeratorWrapper.cs +++ b/src/Adapter/MSTest.TestAdapter/Discovery/AssemblyEnumeratorWrapper.cs @@ -27,7 +27,7 @@ internal sealed class AssemblyEnumeratorWrapper /// The run Settings. /// Contains warnings if any, that need to be passed back to the caller. /// A collection of test elements. - internal ICollection? GetTests(string? assemblyFileName, IRunSettings? runSettings, out ICollection warnings) + internal ICollection? GetTests(string? assemblyFileName, IRunSettings? runSettings, out List warnings) { warnings = new List(); @@ -52,7 +52,7 @@ internal sealed class AssemblyEnumeratorWrapper } // Load the assembly in isolation if required. - return GetTestsInIsolation(fullFilePath, runSettings, out warnings); + return GetTestsInIsolation(fullFilePath, runSettings, warnings); } catch (FileNotFoundException ex) { @@ -98,7 +98,7 @@ internal sealed class AssemblyEnumeratorWrapper } } - private static ICollection GetTestsInIsolation(string fullFilePath, IRunSettings? runSettings, out ICollection warnings) + private static ICollection GetTestsInIsolation(string fullFilePath, IRunSettings? runSettings, List warnings) { using MSTestAdapter.PlatformServices.Interface.ITestSourceHost isolationHost = PlatformServiceProvider.Instance.CreateTestSourceHost(fullFilePath, runSettings, frameworkHandle: null); @@ -117,6 +117,6 @@ private static ICollection GetTestsInIsolation(string fullFileP PlatformServiceProvider.Instance.AdapterTraceLogger.LogWarning(Resource.OlderTFMVersionFound); } - return assemblyEnumerator.EnumerateAssembly(fullFilePath, xml, out warnings); + return assemblyEnumerator.EnumerateAssembly(fullFilePath, xml, warnings); } } diff --git a/src/Adapter/MSTest.TestAdapter/Discovery/TypeEnumerator.cs b/src/Adapter/MSTest.TestAdapter/Discovery/TypeEnumerator.cs index d84a72df10..179dcd9c4b 100644 --- a/src/Adapter/MSTest.TestAdapter/Discovery/TypeEnumerator.cs +++ b/src/Adapter/MSTest.TestAdapter/Discovery/TypeEnumerator.cs @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. -using System.Collections.ObjectModel; using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.Reflection; @@ -54,10 +53,8 @@ internal TypeEnumerator(Type type, string assemblyFilePath, ReflectHelper reflec /// /// Contains warnings if any, that need to be passed back to the caller. /// list of test cases. - internal virtual ICollection? Enumerate(out ICollection warnings) + internal virtual List? Enumerate(List warnings) { - warnings = new Collection(); - if (!_typeValidator.IsValidTestClass(_type, warnings)) { return null; @@ -72,11 +69,11 @@ internal TypeEnumerator(Type type, string assemblyFilePath, ReflectHelper reflec /// /// Contains warnings if any, that need to be passed back to the caller. /// List of Valid Tests. - internal Collection GetTests(ICollection warnings) + internal List GetTests(List warnings) { bool foundDuplicateTests = false; var foundTests = new HashSet(); - var tests = new Collection(); + var tests = new List(); // Test class is already valid. Verify methods. // PERF: GetRuntimeMethods is used here to get all methods, including non-public, and static methods. @@ -119,12 +116,11 @@ internal Collection GetTests(ICollection warnings) currentType = currentType.BaseType; } - return new Collection( - tests.GroupBy( - t => t.TestMethod.Name, - (_, elements) => - elements.OrderBy(t => inheritanceDepths[t.TestMethod.DeclaringClassFullName ?? t.TestMethod.FullClassName]).First()) - .ToList()); + return tests.GroupBy( + t => t.TestMethod.Name, + (_, elements) => + elements.OrderBy(t => inheritanceDepths[t.TestMethod.DeclaringClassFullName ?? t.TestMethod.FullClassName]).First()) + .ToList(); } /// diff --git a/src/Adapter/MSTest.TestAdapter/Discovery/TypeValidator.cs b/src/Adapter/MSTest.TestAdapter/Discovery/TypeValidator.cs index 916c7da27a..89529b150c 100644 --- a/src/Adapter/MSTest.TestAdapter/Discovery/TypeValidator.cs +++ b/src/Adapter/MSTest.TestAdapter/Discovery/TypeValidator.cs @@ -49,7 +49,7 @@ internal TypeValidator(ReflectHelper reflectHelper, bool discoverInternals) /// The reflected type. /// Contains warnings if any, that need to be passed back to the caller. /// Return true if it is a valid test class. - internal virtual bool IsValidTestClass(Type type, ICollection warnings) + internal virtual bool IsValidTestClass(Type type, List warnings) { // PERF: We are doing caching reflection here, meaning we will cache every class info in the // assembly, this is because when we discover and run we will repeatedly inspect all the types in the assembly, and this diff --git a/src/Adapter/MSTest.TestAdapter/Discovery/UnitTestDiscoverer.cs b/src/Adapter/MSTest.TestAdapter/Discovery/UnitTestDiscoverer.cs index bc669c1e79..d81212d69c 100644 --- a/src/Adapter/MSTest.TestAdapter/Discovery/UnitTestDiscoverer.cs +++ b/src/Adapter/MSTest.TestAdapter/Discovery/UnitTestDiscoverer.cs @@ -58,7 +58,7 @@ internal virtual void DiscoverTestsInSource( ITestCaseDiscoverySink discoverySink, IDiscoveryContext? discoveryContext) { - ICollection? testElements = _assemblyEnumeratorWrapper.GetTests(source, discoveryContext?.RunSettings, out ICollection? warnings); + ICollection? testElements = _assemblyEnumeratorWrapper.GetTests(source, discoveryContext?.RunSettings, out List warnings); bool treatDiscoveryWarningsAsErrors = MSTestSettings.CurrentSettings.TreatDiscoveryWarningsAsErrors; diff --git a/test/UnitTests/MSTestAdapter.UnitTests/Discovery/AssemblyEnumeratorTests.cs b/test/UnitTests/MSTestAdapter.UnitTests/Discovery/AssemblyEnumeratorTests.cs index abd54ca45e..d09607fabc 100644 --- a/test/UnitTests/MSTestAdapter.UnitTests/Discovery/AssemblyEnumeratorTests.cs +++ b/test/UnitTests/MSTestAdapter.UnitTests/Discovery/AssemblyEnumeratorTests.cs @@ -26,7 +26,7 @@ public class AssemblyEnumeratorTests : TestContainer private readonly AssemblyEnumerator _assemblyEnumerator; private readonly TestablePlatformServiceProvider _testablePlatformServiceProvider; - private ICollection _warnings; + private readonly List _warnings; public AssemblyEnumeratorTests() { @@ -225,7 +225,7 @@ public void EnumerateAssemblyShouldReturnEmptyListWhenNoDeclaredTypes() _testablePlatformServiceProvider.MockFileOperations.Setup(fo => fo.LoadAssembly("DummyAssembly", false)) .Returns(mockAssembly.Object); - Verify(_assemblyEnumerator.EnumerateAssembly("DummyAssembly", null, out _warnings).Count == 0); + Verify(_assemblyEnumerator.EnumerateAssembly("DummyAssembly", null, _warnings).Count == 0); } public void EnumerateAssemblyShouldReturnEmptyListWhenNoTestElementsInAType() @@ -240,10 +240,10 @@ public void EnumerateAssemblyShouldReturnEmptyListWhenNoTestElementsInAType() .Returns([typeof(DummyTestClass).GetTypeInfo()]); _testablePlatformServiceProvider.MockFileOperations.Setup(fo => fo.LoadAssembly("DummyAssembly", false)) .Returns(mockAssembly.Object); - testableAssemblyEnumerator.MockTypeEnumerator.Setup(te => te.Enumerate(out _warnings)) - .Returns((ICollection)null); + testableAssemblyEnumerator.MockTypeEnumerator.Setup(te => te.Enumerate(_warnings)) + .Returns((List)null); - Verify(_assemblyEnumerator.EnumerateAssembly("DummyAssembly", null, out _warnings).Count == 0); + Verify(_assemblyEnumerator.EnumerateAssembly("DummyAssembly", null, _warnings).Count == 0); } public void EnumerateAssemblyShouldReturnTestElementsForAType() @@ -259,10 +259,10 @@ public void EnumerateAssemblyShouldReturnTestElementsForAType() .Returns([typeof(DummyTestClass).GetTypeInfo()]); _testablePlatformServiceProvider.MockFileOperations.Setup(fo => fo.LoadAssembly("DummyAssembly", false)) .Returns(mockAssembly.Object); - testableAssemblyEnumerator.MockTypeEnumerator.Setup(te => te.Enumerate(out _warnings)) - .Returns(new Collection { unitTestElement }); + testableAssemblyEnumerator.MockTypeEnumerator.Setup(te => te.Enumerate(_warnings)) + .Returns(new List { unitTestElement }); - ICollection testElements = testableAssemblyEnumerator.EnumerateAssembly("DummyAssembly", null, out _warnings); + ICollection testElements = testableAssemblyEnumerator.EnumerateAssembly("DummyAssembly", null, _warnings); Verify(new Collection { unitTestElement }.SequenceEqual(testElements)); } @@ -272,7 +272,7 @@ public void EnumerateAssemblyShouldReturnMoreThanOneTestElementForAType() Mock mockAssembly = CreateMockTestableAssembly(); var testableAssemblyEnumerator = new TestableAssemblyEnumerator(); var unitTestElement = new UnitTestElement(new TestMethod("DummyMethod", "DummyClass", "DummyAssembly", false)); - var expectedTestElements = new Collection { unitTestElement, unitTestElement }; + var expectedTestElements = new List { unitTestElement, unitTestElement }; // Setup mocks mockAssembly.Setup(a => a.GetTypes()) @@ -281,10 +281,10 @@ public void EnumerateAssemblyShouldReturnMoreThanOneTestElementForAType() .Returns([typeof(DummyTestClass).GetTypeInfo()]); _testablePlatformServiceProvider.MockFileOperations.Setup(fo => fo.LoadAssembly("DummyAssembly", false)) .Returns(mockAssembly.Object); - testableAssemblyEnumerator.MockTypeEnumerator.Setup(te => te.Enumerate(out _warnings)) + testableAssemblyEnumerator.MockTypeEnumerator.Setup(te => te.Enumerate(_warnings)) .Returns(expectedTestElements); - ICollection testElements = testableAssemblyEnumerator.EnumerateAssembly("DummyAssembly", null, out _warnings); + ICollection testElements = testableAssemblyEnumerator.EnumerateAssembly("DummyAssembly", null, _warnings); Verify(expectedTestElements.SequenceEqual(testElements)); } @@ -294,7 +294,7 @@ public void EnumerateAssemblyShouldReturnMoreThanOneTestElementForMoreThanOneTyp Mock mockAssembly = CreateMockTestableAssembly(); var testableAssemblyEnumerator = new TestableAssemblyEnumerator(); var unitTestElement = new UnitTestElement(new TestMethod("DummyMethod", "DummyClass", "DummyAssembly", false)); - var expectedTestElements = new Collection { unitTestElement, unitTestElement }; + var expectedTestElements = new List { unitTestElement, unitTestElement }; // Setup mocks mockAssembly.Setup(a => a.GetTypes()) @@ -303,10 +303,10 @@ public void EnumerateAssemblyShouldReturnMoreThanOneTestElementForMoreThanOneTyp .Returns([typeof(DummyTestClass).GetTypeInfo(), typeof(DummyTestClass).GetTypeInfo()]); _testablePlatformServiceProvider.MockFileOperations.Setup(fo => fo.LoadAssembly("DummyAssembly", false)) .Returns(mockAssembly.Object); - testableAssemblyEnumerator.MockTypeEnumerator.Setup(te => te.Enumerate(out _warnings)) + testableAssemblyEnumerator.MockTypeEnumerator.Setup(te => te.Enumerate(_warnings)) .Returns(expectedTestElements); - ICollection testElements = testableAssemblyEnumerator.EnumerateAssembly("DummyAssembly", null, out _warnings); + ICollection testElements = testableAssemblyEnumerator.EnumerateAssembly("DummyAssembly", null, _warnings); expectedTestElements.Add(unitTestElement); expectedTestElements.Add(unitTestElement); @@ -317,7 +317,7 @@ public void EnumerateAssemblyShouldNotLogWarningsIfNonePresent() { Mock mockAssembly = CreateMockTestableAssembly(); var testableAssemblyEnumerator = new TestableAssemblyEnumerator(); - ICollection warningsFromTypeEnumerator = []; + List warningsFromTypeEnumerator = []; // Setup mocks mockAssembly.Setup(a => a.GetTypes()) @@ -326,9 +326,9 @@ public void EnumerateAssemblyShouldNotLogWarningsIfNonePresent() .Returns([typeof(InternalTestClass).GetTypeInfo()]); _testablePlatformServiceProvider.MockFileOperations.Setup(fo => fo.LoadAssembly("DummyAssembly", false)) .Returns(mockAssembly.Object); - testableAssemblyEnumerator.MockTypeEnumerator.Setup(te => te.Enumerate(out warningsFromTypeEnumerator)); + testableAssemblyEnumerator.MockTypeEnumerator.Setup(te => te.Enumerate(warningsFromTypeEnumerator)); - testableAssemblyEnumerator.EnumerateAssembly("DummyAssembly", null, out _warnings); + testableAssemblyEnumerator.EnumerateAssembly("DummyAssembly", null, _warnings); Verify(_warnings.Count == 0); } @@ -336,7 +336,7 @@ public void EnumerateAssemblyShouldLogWarningsIfPresent() { Mock mockAssembly = CreateMockTestableAssembly(); var testableAssemblyEnumerator = new TestableAssemblyEnumerator(); - ICollection warningsFromTypeEnumerator = new Collection + var warningsFromTypeEnumerator = new List { "DummyWarning", }; @@ -348,11 +348,12 @@ public void EnumerateAssemblyShouldLogWarningsIfPresent() .Returns([typeof(InternalTestClass).GetTypeInfo()]); _testablePlatformServiceProvider.MockFileOperations.Setup(fo => fo.LoadAssembly("DummyAssembly", false)) .Returns(mockAssembly.Object); - testableAssemblyEnumerator.MockTypeEnumerator.Setup(te => te.Enumerate(out warningsFromTypeEnumerator)); + testableAssemblyEnumerator.MockTypeEnumerator.Setup(te => te.Enumerate(_warnings)) + .Callback(() => _warnings.AddRange(warningsFromTypeEnumerator)); - testableAssemblyEnumerator.EnumerateAssembly("DummyAssembly", null, out _warnings); + testableAssemblyEnumerator.EnumerateAssembly("DummyAssembly", null, _warnings); - Verify(warningsFromTypeEnumerator.ToList().SequenceEqual(_warnings)); + Verify(warningsFromTypeEnumerator.SequenceEqual(_warnings)); } public void EnumerateAssemblyShouldHandleExceptionsWhileEnumeratingAType() @@ -368,9 +369,9 @@ public void EnumerateAssemblyShouldHandleExceptionsWhileEnumeratingAType() .Returns([typeof(InternalTestClass).GetTypeInfo()]); _testablePlatformServiceProvider.MockFileOperations.Setup(fo => fo.LoadAssembly("DummyAssembly", false)) .Returns(mockAssembly.Object); - testableAssemblyEnumerator.MockTypeEnumerator.Setup(te => te.Enumerate(out _warnings)).Throws(exception); + testableAssemblyEnumerator.MockTypeEnumerator.Setup(te => te.Enumerate(_warnings)).Throws(exception); - testableAssemblyEnumerator.EnumerateAssembly("DummyAssembly", null, out _warnings); + testableAssemblyEnumerator.EnumerateAssembly("DummyAssembly", null, _warnings); Verify(_warnings.ToList().Contains( string.Format( diff --git a/test/UnitTests/MSTestAdapter.UnitTests/Discovery/AssemblyEnumeratorWrapperTests.cs b/test/UnitTests/MSTestAdapter.UnitTests/Discovery/AssemblyEnumeratorWrapperTests.cs index 8b3b433213..2fef0edc25 100644 --- a/test/UnitTests/MSTestAdapter.UnitTests/Discovery/AssemblyEnumeratorWrapperTests.cs +++ b/test/UnitTests/MSTestAdapter.UnitTests/Discovery/AssemblyEnumeratorWrapperTests.cs @@ -21,7 +21,7 @@ public class AssemblyEnumeratorWrapperTests : TestContainer private readonly AssemblyEnumeratorWrapper _testableAssemblyEnumeratorWrapper; private readonly TestablePlatformServiceProvider _testablePlatformServiceProvider; - private ICollection _warnings; + private List _warnings; public AssemblyEnumeratorWrapperTests() { diff --git a/test/UnitTests/MSTestAdapter.UnitTests/Discovery/TypeEnumeratorTests.cs b/test/UnitTests/MSTestAdapter.UnitTests/Discovery/TypeEnumeratorTests.cs index 78c3b2998e..3e2e123c22 100644 --- a/test/UnitTests/MSTestAdapter.UnitTests/Discovery/TypeEnumeratorTests.cs +++ b/test/UnitTests/MSTestAdapter.UnitTests/Discovery/TypeEnumeratorTests.cs @@ -26,7 +26,7 @@ public partial class TypeEnumeratorTests : TestContainer private readonly TestablePlatformServiceProvider _testablePlatformServiceProvider; private readonly Mock _mockMessageLogger; - private ICollection _warnings; + private readonly List _warnings; public TypeEnumeratorTests() { @@ -58,7 +58,7 @@ protected override void Dispose(bool disposing) public void EnumerateShouldReturnNullIfTypeIsNotValid() { TypeEnumerator typeEnumerator = GetTypeEnumeratorInstance(typeof(IDummyInterface), string.Empty); - Verify(typeEnumerator.Enumerate(out _warnings) is null); + Verify(typeEnumerator.Enumerate(_warnings) is null); } public void EnumerateShouldReturnEmptyCollectionWhenNoValidTestMethodsExist() @@ -66,7 +66,7 @@ public void EnumerateShouldReturnEmptyCollectionWhenNoValidTestMethodsExist() SetupTestClassAndTestMethods(isValidTestClass: true, isValidTestMethod: false, isMethodFromSameAssembly: true); TypeEnumerator typeEnumerator = GetTypeEnumeratorInstance(typeof(DummyTestClass), string.Empty); - ICollection tests = typeEnumerator.Enumerate(out _warnings); + ICollection tests = typeEnumerator.Enumerate(_warnings); Verify(tests is not null); Verify(tests.Count == 0); @@ -81,7 +81,7 @@ public void GetTestsShouldReturnDeclaredTestMethods() SetupTestClassAndTestMethods(isValidTestClass: true, isValidTestMethod: true, isMethodFromSameAssembly: true); TypeEnumerator typeEnumerator = GetTypeEnumeratorInstance(typeof(DummyBaseTestClass), Assembly.GetExecutingAssembly().FullName); - ICollection tests = typeEnumerator.Enumerate(out _warnings); + ICollection tests = typeEnumerator.Enumerate(_warnings); Verify(tests is not null); @@ -94,7 +94,7 @@ public void GetTestsShouldReturnBaseTestMethodsInSameAssembly() SetupTestClassAndTestMethods(isValidTestClass: true, isValidTestMethod: true, isMethodFromSameAssembly: true); TypeEnumerator typeEnumerator = GetTypeEnumeratorInstance(typeof(DummyDerivedTestClass), Assembly.GetExecutingAssembly().FullName); - ICollection tests = typeEnumerator.Enumerate(out _warnings); + ICollection tests = typeEnumerator.Enumerate(_warnings); Verify(tests is not null); @@ -125,7 +125,7 @@ public void GetTestsShouldReturnBaseTestMethodsFromAnotherAssemblyByDefault() TypeEnumerator typeEnumerator = GetTypeEnumeratorInstance(typeof(DummyDerivedTestClass), Assembly.GetExecutingAssembly().FullName); - ICollection tests = typeEnumerator.Enumerate(out _warnings); + ICollection tests = typeEnumerator.Enumerate(_warnings); Verify(tests is not null); @@ -155,7 +155,7 @@ public void GetTestsShouldReturnBaseTestMethodsFromAnotherAssemblyByConfiguratio SetupTestClassAndTestMethods(isValidTestClass: true, isValidTestMethod: true, isMethodFromSameAssembly: true); TypeEnumerator typeEnumerator = GetTypeEnumeratorInstance(typeof(DummyDerivedTestClass), Assembly.GetExecutingAssembly().FullName); - ICollection tests = typeEnumerator.Enumerate(out _warnings); + ICollection tests = typeEnumerator.Enumerate(_warnings); Verify(tests is not null); @@ -186,7 +186,7 @@ public void GetTestsShouldNotReturnBaseTestMethodsFromAnotherAssemblyByConfigura SetupTestClassAndTestMethods(isValidTestClass: true, isValidTestMethod: true, isMethodFromSameAssembly: false); TypeEnumerator typeEnumerator = GetTypeEnumeratorInstance(typeof(DummyDerivedTestClass), Assembly.GetExecutingAssembly().FullName); - ICollection tests = typeEnumerator.Enumerate(out _warnings); + ICollection tests = typeEnumerator.Enumerate(_warnings); Verify(tests is not null); @@ -200,7 +200,7 @@ public void GetTestsShouldNotReturnHiddenTestMethods() SetupTestClassAndTestMethods(isValidTestClass: true, isValidTestMethod: true, isMethodFromSameAssembly: true); TypeEnumerator typeEnumerator = GetTypeEnumeratorInstance(typeof(DummyHidingTestClass), Assembly.GetExecutingAssembly().FullName); - ICollection tests = typeEnumerator.Enumerate(out _warnings); + ICollection tests = typeEnumerator.Enumerate(_warnings); Verify(tests is not null); @@ -219,7 +219,7 @@ public void GetTestsShouldReturnOverriddenTestMethods() SetupTestClassAndTestMethods(isValidTestClass: true, isValidTestMethod: true, isMethodFromSameAssembly: true); TypeEnumerator typeEnumerator = GetTypeEnumeratorInstance(typeof(DummyOverridingTestClass), Assembly.GetExecutingAssembly().FullName); - ICollection tests = typeEnumerator.Enumerate(out _warnings); + ICollection tests = typeEnumerator.Enumerate(_warnings); Verify(tests is not null); @@ -242,7 +242,7 @@ public void GetTestsShouldNotReturnHiddenTestMethodsFromAnyLevel() SetupTestClassAndTestMethods(isValidTestClass: true, isValidTestMethod: true, isMethodFromSameAssembly: true); TypeEnumerator typeEnumerator = GetTypeEnumeratorInstance(typeof(DummySecondHidingTestClass), Assembly.GetExecutingAssembly().FullName); - ICollection tests = typeEnumerator.Enumerate(out _warnings); + ICollection tests = typeEnumerator.Enumerate(_warnings); Verify(tests is not null); @@ -567,7 +567,7 @@ public void GetTestFromMethodShouldSetDisplayNameFromDataTestMethodAttribute() private void SetupTestClassAndTestMethods(bool isValidTestClass, bool isValidTestMethod, bool isMethodFromSameAssembly) { - _mockTypeValidator.Setup(tv => tv.IsValidTestClass(It.IsAny(), It.IsAny>())) + _mockTypeValidator.Setup(tv => tv.IsValidTestClass(It.IsAny(), It.IsAny>())) .Returns(isValidTestClass); _mockTestMethodValidator.Setup( tmv => tmv.IsValidTestMethod(It.IsAny(), It.IsAny(), It.IsAny>())).Returns(isValidTestMethod);