Can any one suggest a step by step example for using moQ framework.
any guidelines or thumbrules that has to be followed while mocking objetcs . can be much help.
thanks.
Can any one suggest a step by step example for using moQ framework.
any guidelines or thumbrules that has to be followed while mocking objetcs . can be much help.
thanks.
Update: To address your comment... A large part of writing testable code involves removing dependencies on classes/resources outside the scope of your control. A very common approach to doing this is by talking to interfaces instead of concrete examples.
It's a little much to describe properly (especially since I just rolled out of bed), so let suggest you pick up a copy of Roy Osherove's 'The Art of Unit Testing'. It's a fairly short book and is filled with good advice and lots of summary information to get you familiar with many of the approaches to unit testing.
I only started to use Moq recently and I am not sure how much help this will be but if you can get your hands on Chapter 3 of Pro ASP.NET MVC Framework there is a really good step-by-step example of using moq and NUnit with ASP.NET MVC.
Finally i found a convincing step by step example from the link below.The article is explained using a problem - solution approach