Object disposal that occurs in an overriden method invoked by a base test class is not detected and a diagnostic is reported.
An simplified example that demonstrates the problem:
[TestFixture]
public class BaseTest
{
[SetUp]
public void SetUp()
{
OnSetUp();
}
[TearDown]
public void TearDown()
{
OnTearDown();
}
protected virtual void OnSetUp()
{
}
protected virtual void OnTearDown()
{
}
}
[TestFixture]
public class InheritedTest : BaseTest
{
private IDisposable? disposable;
protected override void OnSetUp()
{
base.OnSetUp();
disposable = new ADisposable();
}
protected override void OnTearDown()
{
disposable?.Dispose();
base.OnTearDown();
}
}
Object disposal that occurs in an overriden method invoked by a base test class is not detected and a diagnostic is reported.
An simplified example that demonstrates the problem: