Is there a good way of testing the result of the IDisposable.Dispose()-method?
Thanks for all your answers.
Is there a good way of testing the result of the IDisposable.Dispose()-method?
Thanks for all your answers.
Ensure that after calling the .Dispose()
method that all function and property getters/setters return an ObjectDisposedException
.
http://msdn.microsoft.com/en-us/library/system.objectdisposedexception.aspx
To unit test the Dispose
method, invoke Dispose
and then check your mocked versions of your connection, session, and cache. Ensure that they are properly closed and cleared.