diff --git a/src/Adapter/MSTest.TestAdapter/Execution/TestClassInfo.cs b/src/Adapter/MSTest.TestAdapter/Execution/TestClassInfo.cs
index 5480c83fac..f5f444bd8d 100644
--- a/src/Adapter/MSTest.TestAdapter/Execution/TestClassInfo.cs
+++ b/src/Adapter/MSTest.TestAdapter/Execution/TestClassInfo.cs
@@ -330,7 +330,7 @@ public void RunClassInitialize(TestContext testContext)
///
/// Any exception that can be thrown as part of a class cleanup as warning messages.
///
- public string? RunClassCleanup(ClassCleanupBehavior classCleanupLifecycle = ClassCleanupBehavior.EndOfClass)
+ public string? RunClassCleanup(ClassCleanupBehavior classCleanupLifecycle = ClassCleanupBehavior.EndOfAssembly)
{
if (ClassCleanupMethod is null && BaseClassInitAndCleanupMethods.All(p => p.Item2 == null))
{
diff --git a/src/Adapter/MSTest.TestAdapter/Execution/UnitTestRunner.cs b/src/Adapter/MSTest.TestAdapter/Execution/UnitTestRunner.cs
index b08e570de5..8e53db7412 100644
--- a/src/Adapter/MSTest.TestAdapter/Execution/UnitTestRunner.cs
+++ b/src/Adapter/MSTest.TestAdapter/Execution/UnitTestRunner.cs
@@ -90,7 +90,7 @@ internal void InitializeClassCleanupManager(ICollection testsTo
{
// We can't transport the Enum across AppDomain boundaries because of backwards and forwards compatibility.
// So we're converting here if we can, or falling back to the default.
- var lifecycle = ClassCleanupBehavior.EndOfClass;
+ var lifecycle = ClassCleanupBehavior.EndOfAssembly;
if (classCleanupLifecycle != null && Enum.IsDefined(typeof(ClassCleanupBehavior), classCleanupLifecycle))
{
lifecycle = (ClassCleanupBehavior)classCleanupLifecycle;
diff --git a/src/Adapter/MSTest.TestAdapter/PublicAPI/PublicAPI.Shipped.txt b/src/Adapter/MSTest.TestAdapter/PublicAPI/PublicAPI.Shipped.txt
index 896f3e561d..d83434a5ad 100644
--- a/src/Adapter/MSTest.TestAdapter/PublicAPI/PublicAPI.Shipped.txt
+++ b/src/Adapter/MSTest.TestAdapter/PublicAPI/PublicAPI.Shipped.txt
@@ -38,7 +38,7 @@ Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.Execution.TestClassInfo.H
Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.Execution.TestClassInfo.IsClassCleanupExecuted.get -> bool
Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.Execution.TestClassInfo.IsClassInitializeExecuted.get -> bool
Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.Execution.TestClassInfo.Parent.get -> Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.Execution.TestAssemblyInfo!
-Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.Execution.TestClassInfo.RunClassCleanup(Microsoft.VisualStudio.TestTools.UnitTesting.ClassCleanupBehavior classCleanupLifecycle = Microsoft.VisualStudio.TestTools.UnitTesting.ClassCleanupBehavior.EndOfClass) -> string?
+Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.Execution.TestClassInfo.RunClassCleanup(Microsoft.VisualStudio.TestTools.UnitTesting.ClassCleanupBehavior classCleanupLifecycle = Microsoft.VisualStudio.TestTools.UnitTesting.ClassCleanupBehavior.EndOfAssembly) -> string?
Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.Execution.TestClassInfo.RunClassInitialize(Microsoft.VisualStudio.TestTools.UnitTesting.TestContext! testContext) -> void
Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.Execution.TestClassInfo.TestCleanupMethod.get -> System.Reflection.MethodInfo?
Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.Execution.TestClassInfo.TestContextProperty.get -> System.Reflection.PropertyInfo?
diff --git a/src/TestFramework/TestFramework/Attributes/Lifecycle/Cleanup/ClassCleanupBehavior.cs b/src/TestFramework/TestFramework/Attributes/Lifecycle/Cleanup/ClassCleanupBehavior.cs
index a39e837b4f..7f829f43ef 100644
--- a/src/TestFramework/TestFramework/Attributes/Lifecycle/Cleanup/ClassCleanupBehavior.cs
+++ b/src/TestFramework/TestFramework/Attributes/Lifecycle/Cleanup/ClassCleanupBehavior.cs
@@ -9,12 +9,12 @@ namespace Microsoft.VisualStudio.TestTools.UnitTesting;
public enum ClassCleanupBehavior
{
///
- /// Run at end of class.
+ /// Run at end of assembly.
///
- EndOfClass,
+ EndOfAssembly,
///
- /// Run at end of assembly.
+ /// Run at end of class.
///
- EndOfAssembly,
+ EndOfClass,
}
diff --git a/src/TestFramework/TestFramework/Attributes/Lifecycle/Cleanup/ClassCleanupExecutionAttribute.cs b/src/TestFramework/TestFramework/Attributes/Lifecycle/Cleanup/ClassCleanupExecutionAttribute.cs
index 1da0df830d..1387c67564 100644
--- a/src/TestFramework/TestFramework/Attributes/Lifecycle/Cleanup/ClassCleanupExecutionAttribute.cs
+++ b/src/TestFramework/TestFramework/Attributes/Lifecycle/Cleanup/ClassCleanupExecutionAttribute.cs
@@ -11,11 +11,16 @@ namespace Microsoft.VisualStudio.TestTools.UnitTesting;
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = false, Inherited = true)]
public class ClassCleanupExecutionAttribute : Attribute
{
+ ///
+ /// Default class cleanup execution.
+ ///
+ public static readonly ClassCleanupBehavior DefaultClassCleanupLifecycle = ClassCleanupBehavior.EndOfAssembly;
+
///
/// Initializes a new instance of the class.
///
public ClassCleanupExecutionAttribute()
- : this(ClassCleanupBehavior.EndOfClass)
+ : this(DefaultClassCleanupLifecycle)
{
}
diff --git a/src/TestFramework/TestFramework/PublicAPI/PublicAPI.Shipped.txt b/src/TestFramework/TestFramework/PublicAPI/PublicAPI.Shipped.txt
index cd4707d305..2d2feb3767 100644
--- a/src/TestFramework/TestFramework/PublicAPI/PublicAPI.Shipped.txt
+++ b/src/TestFramework/TestFramework/PublicAPI/PublicAPI.Shipped.txt
@@ -22,8 +22,8 @@ Microsoft.VisualStudio.TestTools.UnitTesting.ClassCleanupAttribute.ClassCleanupA
Microsoft.VisualStudio.TestTools.UnitTesting.ClassCleanupAttribute.CleanupBehavior.get -> Microsoft.VisualStudio.TestTools.UnitTesting.ClassCleanupBehavior?
Microsoft.VisualStudio.TestTools.UnitTesting.ClassCleanupAttribute.InheritanceBehavior.get -> Microsoft.VisualStudio.TestTools.UnitTesting.InheritanceBehavior
Microsoft.VisualStudio.TestTools.UnitTesting.ClassCleanupBehavior
-Microsoft.VisualStudio.TestTools.UnitTesting.ClassCleanupBehavior.EndOfAssembly = 1 -> Microsoft.VisualStudio.TestTools.UnitTesting.ClassCleanupBehavior
-Microsoft.VisualStudio.TestTools.UnitTesting.ClassCleanupBehavior.EndOfClass = 0 -> Microsoft.VisualStudio.TestTools.UnitTesting.ClassCleanupBehavior
+Microsoft.VisualStudio.TestTools.UnitTesting.ClassCleanupBehavior.EndOfAssembly = 0 -> Microsoft.VisualStudio.TestTools.UnitTesting.ClassCleanupBehavior
+Microsoft.VisualStudio.TestTools.UnitTesting.ClassCleanupBehavior.EndOfClass = 1 -> Microsoft.VisualStudio.TestTools.UnitTesting.ClassCleanupBehavior
Microsoft.VisualStudio.TestTools.UnitTesting.ClassCleanupExecutionAttribute
Microsoft.VisualStudio.TestTools.UnitTesting.ClassCleanupExecutionAttribute.ClassCleanupExecutionAttribute() -> void
Microsoft.VisualStudio.TestTools.UnitTesting.ClassCleanupExecutionAttribute.ClassCleanupExecutionAttribute(Microsoft.VisualStudio.TestTools.UnitTesting.ClassCleanupBehavior cleanupBehavior) -> void
@@ -326,6 +326,7 @@ static Microsoft.VisualStudio.TestTools.UnitTesting.CollectionAssert.That.get ->
static Microsoft.VisualStudio.TestTools.UnitTesting.Logging.Logger.LogMessage(string! format, params object?[]! args) -> void
static Microsoft.VisualStudio.TestTools.UnitTesting.Logging.Logger.OnLogMessage -> Microsoft.VisualStudio.TestTools.UnitTesting.Logging.Logger.LogMessageHandler?
static Microsoft.VisualStudio.TestTools.UnitTesting.StringAssert.That.get -> Microsoft.VisualStudio.TestTools.UnitTesting.StringAssert!
+static readonly Microsoft.VisualStudio.TestTools.UnitTesting.ClassCleanupExecutionAttribute.DefaultClassCleanupLifecycle -> Microsoft.VisualStudio.TestTools.UnitTesting.ClassCleanupBehavior
static readonly Microsoft.VisualStudio.TestTools.UnitTesting.DataSourceAttribute.DefaultDataAccessMethod -> Microsoft.VisualStudio.TestTools.UnitTesting.DataAccessMethod
static readonly Microsoft.VisualStudio.TestTools.UnitTesting.DataSourceAttribute.DefaultProviderName -> string!
virtual Microsoft.VisualStudio.TestTools.UnitTesting.DataRowAttribute.GetDisplayName(System.Reflection.MethodInfo! methodInfo, object?[]? data) -> string?
diff --git a/test/IntegrationTests/MSTest.VstestConsoleWrapper.IntegrationTests/SuiteLifeCycleTests.cs b/test/IntegrationTests/MSTest.VstestConsoleWrapper.IntegrationTests/SuiteLifeCycleTests.cs
index bdeaff0280..41a3f506c2 100644
--- a/test/IntegrationTests/MSTest.VstestConsoleWrapper.IntegrationTests/SuiteLifeCycleTests.cs
+++ b/test/IntegrationTests/MSTest.VstestConsoleWrapper.IntegrationTests/SuiteLifeCycleTests.cs
@@ -153,7 +153,6 @@ private void ValidateTestRunLifecycle(string targetFramework)
targetFramework: targetFramework);
RunEventsHandler.PassedTests.Should().HaveCount(27); // The inherit class tests are called twice.
- // The cleanup will appear in this case as the default ClassCleanup is EndOfClass.
var caseClassCleanup = RunEventsHandler.PassedTests.Single(x => x.TestCase.FullyQualifiedName.Contains("LifeCycleClassCleanup.TestMethod"));
caseClassCleanup.Outcome.Should().Be(Microsoft.VisualStudio.TestPlatform.ObjectModel.TestOutcome.Passed);
caseClassCleanup.Messages.Should().HaveCount(3);
@@ -168,7 +167,6 @@ private void ValidateTestRunLifecycle(string targetFramework)
{(targetFramework == "net6.0"
? "Console: LifeCycleClassCleanup.DisposeAsync was called\r\nConsole: LifeCycleClassCleanup.Dispose was called"
: "Console: LifeCycleClassCleanup.Dispose was called")}
- Console: LifeCycleClassCleanup.ClassCleanup was called
""");
caseClassCleanup.Messages[1].Text.Should().Be(
@@ -187,8 +185,7 @@ private void ValidateTestRunLifecycle(string targetFramework)
+ "\r\n"
+ GenerateTraceDebugPrefixedMessage("LifeCycleClassCleanup.Dispose was called")
: GenerateTraceDebugPrefixedMessage("LifeCycleClassCleanup.Dispose was called"))}
- {GenerateTraceDebugPrefixedMessage("LifeCycleClassCleanup.ClassCleanup was called")}
-
+
""");
caseClassCleanup.Messages[2].Text.Should().Be(
$"""
@@ -204,7 +201,6 @@ LifeCycleClassCleanup.TestCleanup was called
{(targetFramework == "net6.0"
? "LifeCycleClassCleanup.DisposeAsync was called\r\nLifeCycleClassCleanup.Dispose was called"
: "LifeCycleClassCleanup.Dispose was called")}
- LifeCycleClassCleanup.ClassCleanup was called
""");
@@ -1572,6 +1568,7 @@ LifeCycleClassCleanupEndOfClassAndNone.TestCleanup was called
var expectedRemainingMessages =
"""
Console: LifeCycleDerivedClassInitializeNoneAndClassCleanupBeforeEachDerivedClass.ClassCleanup was called
+ Console: LifeCycleClassCleanup.ClassCleanup was called
Console: LifeCycleClassCleanupEndOfAssemblyAndBeforeEachDerivedClass.ClassCleanup was called
Console: LifeCycleClassInitializeNoneAndClassCleanupBeforeEachDerivedClass.ClassCleanup was called
Console: LifeCycleDerivedClassCleanupEndOfAssemblyAndNone.ClassCleanup was called
@@ -1627,6 +1624,7 @@ LifeCycleClassCleanupEndOfClassAndNone.TestCleanup was called
{GenerateTraceDebugPrefixedMessage("LifeCycleClassInitializeAndCleanupNone.ClassCleanup was called")}
{GenerateTraceDebugPrefixedMessage("LifeCycleClassCleanupEndOfAssemblyAndNone.ClassCleanup was called")}
{GenerateTraceDebugPrefixedMessage("LifeCycleDerivedClassInitializeBeforeEachDerivedClassAndClassCleanupNone.ClassCleanup was called")}
+ {GenerateTraceDebugPrefixedMessage("LifeCycleClassCleanup.ClassCleanup was called")}
{GenerateTraceDebugPrefixedMessage("LifeCycleDerivedClassInitializeNoneAndClassCleanupBeforeEachDerivedClass.ClassCleanup was called")}
{GenerateTraceDebugPrefixedMessage("LifeCycleClassInitializeBeforeEachDerivedClassAndClassCleanupNone.ClassCleanup was called")}
{GenerateTraceDebugPrefixedMessage("LifeCycleDerivedClassInitializeAndCleanupNone.ClassCleanup was called")}
@@ -1678,6 +1676,7 @@ LifeCycleDerivedClassCleanupEndOfClassAndBeforeEachDerivedClass.ClassCleanup was
LifeCycleDerivedClassCleanupEndOfAssemblyAndBeforeEachDerivedClass.ClassCleanup was called
LifeCycleDerivedClassCleanupEndOfClassAndNone.ClassCleanup was called
LifeCycleClassCleanupEndOfAssemblyAndNone.ClassCleanup was called
+ LifeCycleClassCleanup.ClassCleanup was called
LifeCycleClassInitializeNoneAndClassCleanupBeforeEachDerivedClass.ClassCleanup was called
LifeCycleDerivedClassInitializeAndCleanupNone.ClassCleanup was called
LifeCycleClassInitializeAndCleanupNone.ClassCleanup was called
diff --git a/test/IntegrationTests/TestAssets/SuiteLifeCycleTestProject/LifeCycleClassInitializeAndCleanupBeforeEachDerivedClass.cs b/test/IntegrationTests/TestAssets/SuiteLifeCycleTestProject/LifeCycleClassInitializeAndCleanupBeforeEachDerivedClass.cs
index 2c1b5bd694..3182b45aef 100644
--- a/test/IntegrationTests/TestAssets/SuiteLifeCycleTestProject/LifeCycleClassInitializeAndCleanupBeforeEachDerivedClass.cs
+++ b/test/IntegrationTests/TestAssets/SuiteLifeCycleTestProject/LifeCycleClassInitializeAndCleanupBeforeEachDerivedClass.cs
@@ -87,7 +87,7 @@ public ValueTask DisposeAsync()
}
#endif
- [ClassCleanup(InheritanceBehavior.BeforeEachDerivedClass, ClassCleanupBehavior.EndOfAssembly)]
+ [ClassCleanup(InheritanceBehavior.BeforeEachDerivedClass)]
public static void ClassCleanup()
{
s_testContext.WriteLine("LifeCycleClassInitializeAndCleanupBeforeEachDerivedClass.ClassCleanup was called");
diff --git a/test/IntegrationTests/TestAssets/SuiteLifeCycleTestProject/LifeCycleClassInitializeAndCleanupNone.cs b/test/IntegrationTests/TestAssets/SuiteLifeCycleTestProject/LifeCycleClassInitializeAndCleanupNone.cs
index 4f7b807570..888c57a8f6 100644
--- a/test/IntegrationTests/TestAssets/SuiteLifeCycleTestProject/LifeCycleClassInitializeAndCleanupNone.cs
+++ b/test/IntegrationTests/TestAssets/SuiteLifeCycleTestProject/LifeCycleClassInitializeAndCleanupNone.cs
@@ -87,7 +87,7 @@ public ValueTask DisposeAsync()
}
#endif
- [ClassCleanup(InheritanceBehavior.None, ClassCleanupBehavior.EndOfAssembly)]
+ [ClassCleanup(InheritanceBehavior.None)]
public static void ClassCleanup()
{
s_testContext.WriteLine("LifeCycleClassInitializeAndCleanupNone.ClassCleanup was called");
diff --git a/test/IntegrationTests/TestAssets/SuiteLifeCycleTestProject/LifeCycleClassInitializeBeforeEachDerivedClassAndClassCleanupNone.cs b/test/IntegrationTests/TestAssets/SuiteLifeCycleTestProject/LifeCycleClassInitializeBeforeEachDerivedClassAndClassCleanupNone.cs
index 19db618a9e..b1a5d179c5 100644
--- a/test/IntegrationTests/TestAssets/SuiteLifeCycleTestProject/LifeCycleClassInitializeBeforeEachDerivedClassAndClassCleanupNone.cs
+++ b/test/IntegrationTests/TestAssets/SuiteLifeCycleTestProject/LifeCycleClassInitializeBeforeEachDerivedClassAndClassCleanupNone.cs
@@ -87,7 +87,7 @@ public ValueTask DisposeAsync()
}
#endif
- [ClassCleanup(InheritanceBehavior.None, ClassCleanupBehavior.EndOfAssembly)]
+ [ClassCleanup(InheritanceBehavior.None)]
public static void ClassCleanup()
{
s_testContext.WriteLine("LifeCycleClassInitializeBeforeEachDerivedClassAndClassCleanupNone.ClassCleanup was called");
diff --git a/test/IntegrationTests/TestAssets/SuiteLifeCycleTestProject/LifeCycleClassInitializeNoneAndClassCleanupBeforeEachDerivedClass.cs b/test/IntegrationTests/TestAssets/SuiteLifeCycleTestProject/LifeCycleClassInitializeNoneAndClassCleanupBeforeEachDerivedClass.cs
index 8122f204d2..be38a76fe6 100644
--- a/test/IntegrationTests/TestAssets/SuiteLifeCycleTestProject/LifeCycleClassInitializeNoneAndClassCleanupBeforeEachDerivedClass.cs
+++ b/test/IntegrationTests/TestAssets/SuiteLifeCycleTestProject/LifeCycleClassInitializeNoneAndClassCleanupBeforeEachDerivedClass.cs
@@ -87,7 +87,7 @@ public ValueTask DisposeAsync()
}
#endif
- [ClassCleanup(InheritanceBehavior.BeforeEachDerivedClass, ClassCleanupBehavior.EndOfAssembly)]
+ [ClassCleanup(InheritanceBehavior.BeforeEachDerivedClass)]
public static void ClassCleanup()
{
s_testContext.WriteLine("LifeCycleClassInitializeNoneAndClassCleanupBeforeEachDerivedClass.ClassCleanup was called");
diff --git a/test/IntegrationTests/TestAssets/SuiteLifeCycleTestProject/LifeCycleDerivedClassCleanupEndOfAssemblyAndBeforeEachDerivedClass.cs b/test/IntegrationTests/TestAssets/SuiteLifeCycleTestProject/LifeCycleDerivedClassCleanupEndOfAssemblyAndBeforeEachDerivedClass.cs
index cd544c7406..d836891284 100644
--- a/test/IntegrationTests/TestAssets/SuiteLifeCycleTestProject/LifeCycleDerivedClassCleanupEndOfAssemblyAndBeforeEachDerivedClass.cs
+++ b/test/IntegrationTests/TestAssets/SuiteLifeCycleTestProject/LifeCycleDerivedClassCleanupEndOfAssemblyAndBeforeEachDerivedClass.cs
@@ -60,7 +60,7 @@ public void DerivedClassTestCleanup()
Debug.WriteLine("Debug: LifeCycleDerivedClassCleanupEndOfAssemblyAndBeforeEachDerivedClass.TestCleanup was called");
}
- [ClassCleanup(ClassCleanupBehavior.EndOfAssembly)]
+ [ClassCleanup]
public static void DerivedClassCleanup()
{
s_testContext.WriteLine("LifeCycleDerivedClassCleanupEndOfAssemblyAndBeforeEachDerivedClass.ClassCleanup was called");
diff --git a/test/IntegrationTests/TestAssets/SuiteLifeCycleTestProject/LifeCycleDerivedClassCleanupEndOfAssemblyAndNone.cs b/test/IntegrationTests/TestAssets/SuiteLifeCycleTestProject/LifeCycleDerivedClassCleanupEndOfAssemblyAndNone.cs
index a7c27e8b04..62b95bab86 100644
--- a/test/IntegrationTests/TestAssets/SuiteLifeCycleTestProject/LifeCycleDerivedClassCleanupEndOfAssemblyAndNone.cs
+++ b/test/IntegrationTests/TestAssets/SuiteLifeCycleTestProject/LifeCycleDerivedClassCleanupEndOfAssemblyAndNone.cs
@@ -60,7 +60,7 @@ public void DerivedClassTestCleanup()
Debug.WriteLine("Debug: LifeCycleDerivedClassCleanupEndOfAssemblyAndNone.TestCleanup was called");
}
- [ClassCleanup(ClassCleanupBehavior.EndOfAssembly)]
+ [ClassCleanup]
public static void DerivedClassCleanup()
{
s_testContext.WriteLine("LifeCycleDerivedClassCleanupEndOfAssemblyAndNone.ClassCleanup was called");
diff --git a/test/IntegrationTests/TestAssets/SuiteLifeCycleTestProject/LifeCycleDerivedClassCleanupEndOfClassAndBeforeEachDerivedClass.cs b/test/IntegrationTests/TestAssets/SuiteLifeCycleTestProject/LifeCycleDerivedClassCleanupEndOfClassAndBeforeEachDerivedClass.cs
index 849463af7b..b03078b4e9 100644
--- a/test/IntegrationTests/TestAssets/SuiteLifeCycleTestProject/LifeCycleDerivedClassCleanupEndOfClassAndBeforeEachDerivedClass.cs
+++ b/test/IntegrationTests/TestAssets/SuiteLifeCycleTestProject/LifeCycleDerivedClassCleanupEndOfClassAndBeforeEachDerivedClass.cs
@@ -60,7 +60,7 @@ public void DerivedClassTestCleanup()
Debug.WriteLine("Debug: LifeCycleDerivedClassCleanupEndOfClassAndBeforeEachDerivedClass.TestCleanup was called");
}
- [ClassCleanup(ClassCleanupBehavior.EndOfAssembly)]
+ [ClassCleanup]
public static void DerivedClassCleanup()
{
s_testContext.WriteLine("LifeCycleDerivedClassCleanupEndOfClassAndBeforeEachDerivedClass.ClassCleanup was called");
diff --git a/test/IntegrationTests/TestAssets/SuiteLifeCycleTestProject/LifeCycleDerivedClassCleanupEndOfClassAndNone.cs b/test/IntegrationTests/TestAssets/SuiteLifeCycleTestProject/LifeCycleDerivedClassCleanupEndOfClassAndNone.cs
index 0e0cc9b262..2e0be93a90 100644
--- a/test/IntegrationTests/TestAssets/SuiteLifeCycleTestProject/LifeCycleDerivedClassCleanupEndOfClassAndNone.cs
+++ b/test/IntegrationTests/TestAssets/SuiteLifeCycleTestProject/LifeCycleDerivedClassCleanupEndOfClassAndNone.cs
@@ -60,7 +60,7 @@ public void DerivedClassTestCleanup()
Debug.WriteLine("Debug: LifeCycleDerivedClassCleanupEndOfClassAndNone.TestCleanup was called");
}
- [ClassCleanup(ClassCleanupBehavior.EndOfAssembly)]
+ [ClassCleanup]
public static void DerivedClassCleanup()
{
s_testContext.WriteLine("LifeCycleDerivedClassCleanupEndOfClassAndNone.ClassCleanup was called");
diff --git a/test/IntegrationTests/TestAssets/SuiteLifeCycleTestProject/LifeCycleDerivedClassInitializeAndCleanupBeforeEachDerivedClass.cs b/test/IntegrationTests/TestAssets/SuiteLifeCycleTestProject/LifeCycleDerivedClassInitializeAndCleanupBeforeEachDerivedClass.cs
index ebf932e828..80272222e8 100644
--- a/test/IntegrationTests/TestAssets/SuiteLifeCycleTestProject/LifeCycleDerivedClassInitializeAndCleanupBeforeEachDerivedClass.cs
+++ b/test/IntegrationTests/TestAssets/SuiteLifeCycleTestProject/LifeCycleDerivedClassInitializeAndCleanupBeforeEachDerivedClass.cs
@@ -60,7 +60,7 @@ public void DerivedClassTestCleanup()
Debug.WriteLine("Debug: LifeCycleDerivedClassInitializeAndCleanupBeforeEachDerivedClass.TestCleanup was called");
}
- [ClassCleanup(ClassCleanupBehavior.EndOfAssembly)]
+ [ClassCleanup]
public static void DerivedClassCleanup()
{
s_testContext.WriteLine("LifeCycleDerivedClassInitializeAndCleanupBeforeEachDerivedClass.ClassCleanup was called");
diff --git a/test/IntegrationTests/TestAssets/SuiteLifeCycleTestProject/LifeCycleDerivedClassInitializeAndCleanupNone.cs b/test/IntegrationTests/TestAssets/SuiteLifeCycleTestProject/LifeCycleDerivedClassInitializeAndCleanupNone.cs
index 54b9788c65..fbfcdbe06b 100644
--- a/test/IntegrationTests/TestAssets/SuiteLifeCycleTestProject/LifeCycleDerivedClassInitializeAndCleanupNone.cs
+++ b/test/IntegrationTests/TestAssets/SuiteLifeCycleTestProject/LifeCycleDerivedClassInitializeAndCleanupNone.cs
@@ -60,7 +60,7 @@ public void DerivedClassTestCleanup()
Debug.WriteLine("Debug: LifeCycleDerivedClassInitializeAndCleanupNone.TestCleanup was called");
}
- [ClassCleanup(ClassCleanupBehavior.EndOfAssembly)]
+ [ClassCleanup]
public static void DerivedClassCleanup()
{
s_testContext.WriteLine("LifeCycleDerivedClassInitializeAndCleanupNone.ClassCleanup was called");
diff --git a/test/IntegrationTests/TestAssets/SuiteLifeCycleTestProject/LifeCycleDerivedClassInitializeBeforeEachDerivedClassAndClassCleanupNone.cs b/test/IntegrationTests/TestAssets/SuiteLifeCycleTestProject/LifeCycleDerivedClassInitializeBeforeEachDerivedClassAndClassCleanupNone.cs
index 22829e6324..53c7479a06 100644
--- a/test/IntegrationTests/TestAssets/SuiteLifeCycleTestProject/LifeCycleDerivedClassInitializeBeforeEachDerivedClassAndClassCleanupNone.cs
+++ b/test/IntegrationTests/TestAssets/SuiteLifeCycleTestProject/LifeCycleDerivedClassInitializeBeforeEachDerivedClassAndClassCleanupNone.cs
@@ -61,7 +61,7 @@ public void DerivedClassTestCleanup()
Debug.WriteLine("Debug: LifeCycleDerivedClassInitializeBeforeEachDerivedClassAndClassCleanupNone.TestCleanup was called");
}
- [ClassCleanup(ClassCleanupBehavior.EndOfAssembly)]
+ [ClassCleanup]
public static void DerivedClassCleanup()
{
s_testContext.WriteLine("LifeCycleDerivedClassInitializeBeforeEachDerivedClassAndClassCleanupNone.ClassCleanup was called");
diff --git a/test/IntegrationTests/TestAssets/SuiteLifeCycleTestProject/LifeCycleDerivedClassInitializeNoneAndClassCleanupBeforeEachDerivedClass.cs b/test/IntegrationTests/TestAssets/SuiteLifeCycleTestProject/LifeCycleDerivedClassInitializeNoneAndClassCleanupBeforeEachDerivedClass.cs
index 31c6fcbdff..ef1d52805c 100644
--- a/test/IntegrationTests/TestAssets/SuiteLifeCycleTestProject/LifeCycleDerivedClassInitializeNoneAndClassCleanupBeforeEachDerivedClass.cs
+++ b/test/IntegrationTests/TestAssets/SuiteLifeCycleTestProject/LifeCycleDerivedClassInitializeNoneAndClassCleanupBeforeEachDerivedClass.cs
@@ -61,7 +61,7 @@ public void DerivedClassTestCleanup()
Debug.WriteLine("Debug: LifeCycleDerivedClassInitializeNoneAndClassCleanupBeforeEachDerivedClass.TestCleanup was called");
}
- [ClassCleanup(ClassCleanupBehavior.EndOfAssembly)]
+ [ClassCleanup]
public static void DerivedClassCleanup()
{
s_testContext.WriteLine("LifeCycleDerivedClassInitializeNoneAndClassCleanupBeforeEachDerivedClass.ClassCleanup was called");
diff --git a/test/UnitTests/MSTestAdapter.UnitTests/Execution/TestClassInfoTests.cs b/test/UnitTests/MSTestAdapter.UnitTests/Execution/TestClassInfoTests.cs
index 8fe12a2b8d..64097fd886 100644
--- a/test/UnitTests/MSTestAdapter.UnitTests/Execution/TestClassInfoTests.cs
+++ b/test/UnitTests/MSTestAdapter.UnitTests/Execution/TestClassInfoTests.cs
@@ -491,7 +491,7 @@ public void RunClassCleanupShouldReturnAssertFailureExceptionDetails()
_testClassInfo.ClassCleanupMethod = typeof(DummyTestClass).GetMethod(nameof(DummyTestClass.ClassCleanupMethod));
// Act
- var classCleanup = _testClassInfo.RunClassCleanup(UTF.ClassCleanupBehavior.EndOfAssembly);
+ var classCleanup = _testClassInfo.RunClassCleanup();
// Assert
Verify(classCleanup.StartsWith("Class Cleanup method DummyTestClass.ClassCleanupMethod failed."));
@@ -506,7 +506,7 @@ public void RunClassCleanupShouldReturnAssertInconclusiveExceptionDetails()
_testClassInfo.ClassCleanupMethod = typeof(DummyTestClass).GetMethod(nameof(DummyTestClass.ClassCleanupMethod));
// Act
- var classCleanup = _testClassInfo.RunClassCleanup(UTF.ClassCleanupBehavior.EndOfAssembly);
+ var classCleanup = _testClassInfo.RunClassCleanup();
// Assert
Verify(classCleanup.StartsWith("Class Cleanup method DummyTestClass.ClassCleanupMethod failed."));
@@ -521,7 +521,7 @@ public void RunClassCleanupShouldReturnExceptionDetailsOfNonAssertExceptions()
_testClassInfo.ClassCleanupMethod = typeof(DummyTestClass).GetMethod(nameof(DummyTestClass.ClassCleanupMethod));
// Act
- var classCleanup = _testClassInfo.RunClassCleanup(UTF.ClassCleanupBehavior.EndOfAssembly);
+ var classCleanup = _testClassInfo.RunClassCleanup();
// Assert
Verify(classCleanup.StartsWith("Class Cleanup method DummyTestClass.ClassCleanupMethod failed."));
@@ -539,7 +539,7 @@ public void RunBaseClassCleanupWithNoDerivedClassCleanupShouldReturnExceptionDet
_testClassInfo.BaseClassCleanupMethodsStack.Push(baseClassCleanupMethod);
// Act
- var classCleanup = _testClassInfo.RunClassCleanup(UTF.ClassCleanupBehavior.EndOfAssembly);
+ var classCleanup = _testClassInfo.RunClassCleanup();
// Assert
Verify(classCleanup.StartsWith("Class Cleanup method DummyBaseTestClass.CleanupClassMethod failed."));