Re: How do I unit test a Dispose method ?
David Burstin <[email protected]> Mon, 3 Feb 2014 16:39:59 +1100
| Newsgroups | gmane.comp.programming.test-driven-development |
|---|---|
| Message-ID | <CAKKh91BNQZ6AcvHbAA9FwrnGuXDD-Fae55UmfDqUHuVb1K8QEQ@mail.gmail.com> |
Amir, I feel like I might be missing your point. Why is it unreasonable for A to know that B uses expensive resources and provides a way to release them early? Surely this was one of the considerations when choosing B over X or Y or Z. IMHO it's a characteristic, not an implementation detail. On 3 February 2014 15:19, Amir Kolsky <[email protected]> wrote: > > > > > Except that B must already be IDisposable. The IDisposable pattern > requires that any object that owns an IDisposable must itself implement > IDisposable. > > > > n This is inane, as it requires the owning object to know about > implementation details of it's ownee. > > I disagree. All that A needs to know is that B implements the IDisposable > interface. > > > > * A has to know about something pertaining to B that has nothing to do > with why A needs it. > > >