The situation . Some of my integration test classes use a common approach to setting up scripts in the database, so I provide an abstract base class. He also takes care to completely clear the data at the end after all the tests:
public abstract class IntegrationTests
{
...
protected static void Cleanup() { ... }
}
My legacy classes should call the base method to make sure my database cleanup code works:
[TestClass]
public class FooIntegrationTests : IntegrationTests
{
...
[ClassCleanup]
public static void FooCleanup()
{
...
Cleanup();
}
}
Problem . According to MSDN, "[one] one method in a class can be decorated with [ClassCleanup]", so I cannot decorate a method Cleanupfrom a base class, and even if I did, the method would not receive a call.
Question : I need a solution that
, , . , (!) . ?
. , , , , .