c# - Mocking IDisposable classes -


Scenario: I have a class that subscribes to my default constructor for a constant event. As such, class IDisposable is made, as if it can unsubscribe from the stationary event and collect the garbage appropriately. This class is being joking in the test using the rhinomox . This composite part is children, which can or may not be IDisposable .

Problem: I'm leaking these objects due to the Dodge method RhinoMocks .

Q: I know that Rhinomox has been told in a manner that the basic method should be called. ( CallOriginalMethod ), but I have noticed that Rhinomox sometimes creates itself behind the curtain beyond my declarations like, I do not think I should be leaking the object Can stop me Is there a way to solve this problem?

When you mock a class, you can pass in additional interface (or type) (I.e. IDisposable)

During the tuning of the unit test, you will be given a type of IDisposable and call settlement

Comments

Popular posts from this blog

xml - Complex xPath query with getNodeSet in R -

vbscript - Delete registry folder and sub folder using VBS -

multithreading - PhantomJS-Node in a for Loop -