Closed viceroypenguin closed 3 hours ago
Yep that's exactly right. Store your generated disposable in a field and then use the ITestEndEvent
interface to be notified when the test finished and then you can access your field and dispose it :)
Just pushing out an update to the docs to reflect this too.
Thanks for noticing!
The Class Constructor Helpers page (https://thomhurst.github.io/TUnit/docs/tutorial-extras/class-constructors) has outdated documentation.
It indicates that you can use
DisposeAsync()
to handle the end of the scope. However,DisposeAsync()
will never get called as written on that page. I believe the correct pattern is to useITestEndEvent
, but I would like to confirm.Thanks