Re: establishing logical test order?
"Butler, Tony (London)" <[email protected]>
| Newsgroups | gmane.comp.windows.dotnet.nunit.user |
|---|---|
| Message-ID | <[email protected]> |
Tony wrote: > This is a very good example of why dependency injection is so useful. When David wrote: >Are you implying that you mock our EVERY object outside the object-in-test? >so it is always only YOUR code you are testing? In theory, yes, that is what one "should" do, but in practice, you have to be a bit pragmatic at times. I would say "it depends" (no pun intended!) on the situation, you may make a judgement call that it is over engineering your solution, or that it is just not worth doing simply so you can mock it out in a test (eg because the effort to mock it is greater than the perceived benefit). There are many places where DI can be very useful - eg when different people are working independently on different "layers" of an application, or where there are multiple implementations of something which can be swapped in/out, or where you are testing and don't want to use "expensive resources" (eg database calls) every time you run your test. Not everyone is aware of DI - I just thought I'd point it out as an option to consider. >DI is a good tool, but it is not the right tool for every dependency in every situation. Agreed. As with anything in life, over use can be just as bad as under use :) Cheers, Tony -------------------------------------------------------- This message w/attachments (message) may be privileged, confidential or proprietary, and if you are not an intended recipient, please notify the sender, do not use or share it and delete it. Unless specifically indicated, this message is not an offer to sell or a solicitation of any investment products or other financial product or service, an official confirmation of any transaction, or an official statement of Merrill Lynch. Subject to applicable law, Merrill Lynch may monitor, review and retain e-communications (EC) traveling through its networks/systems. The laws of the country of each sender/recipient may impact the handling of EC, and EC may be archived, supervised and produced in countries other than the country in which you are located. This message cannot be guaranteed to be secur e or error-free. This message is subject to terms available at the following link: http://www.ml.com/e-communications_terms/. By messaging with Merrill Lynch you consent to the foregoing. -------------------------------------------------------- ------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php