0

I have a VS winforms project which has lot of database calls.

Whenever i create unit testing, there is more number of methods, taking more time to consume and more number of unit test projects.

How do i isolate DB calls or will i be able to isolate DB calls if i use microsoft's moles and pex? Any samples on moles and pex will be highly helpful.

Sharpeye500
  • 8,775
  • 25
  • 95
  • 143
  • 1
    Until they get out of research, I'd not rely on either Pex and Moles for any kind of enterprise and automated build. They are still a little rough around the edges. It sounds to me like you probably need to use Moq and some kind of IOC container (Unity or Spring.net for example) and try to create an isolated data access layer. If that doesn't work for you, go ahead and do integration style "unit tests" and inject the data you need prior to running the test. I'd do this on a local database that is as empty as possible so you don't have conflicts with others. – John Dahle Jan 30 '12 at 18:38

1 Answers1

0

You can isolate anything - database calls, web services calls, SharePoint. It does not matter. Your project has references to a number of external dependencies like System.Data. You can either grab the pre-built moles assemblies or build you own. Framework is pretty rough at some points, but it works.

Stan Bashtavenko
  • 1,025
  • 11
  • 16