Tortuga-TestMonkey
Tortuga-TestMonkey copied to clipboard
IDisposable Tests
foreach (var constructor in Class.Constructors.Where(c => c.IsCreatable))
{
<text>
@Tag("IDisposable")
@TestAttribute
public void @(Test.ClassName + "_DisposeTwice_" + constructor.SafeName)()
{
IDisposable objectUnderTest = @constructor.GetConstructorCode();
try
{
objectUnderTest = @constructor.GetConstructorCode();
}
catch (ArgumentException)
{
return; //cannot continue test
}
objectUnderTest.Dispose();
objectUnderTest.Dispose(); //second call should be a no-op
}
</text>
}