thomhurst / TUnit

A modern, fast and flexible .NET testing framework
MIT License
2.15k stars 35 forks source link

[DOC]: Invalid documentation in `Class Constructor Helpers` #1003

Closed viceroypenguin closed 3 hours ago

viceroypenguin commented 3 hours ago

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 use ITestEndEvent, but I would like to confirm.

Thanks

thomhurst commented 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!