mock (1,846)


sql server - How do I unit test persistence?

sql server - How do I unit test persistence?

As a novice in practicing test-driven development, I often end up in a quandary as to how to unit test persistence to a database. I know that technically this would be an integration test(not a unit…


testing - What is Object Mocking and when do I need it?

Many people use Mock Objects when they are writing unit tests. What is a Mock Object ? Why would I ever need one? Do I need a Mock Object Framework?…


unit testing - How do you mock a Sealed class?

Mocking sealed classes can be quite a pain. I currently favor an Adapter pattern to handle this, but something about just keeps feels weird. So, What is the best way you mock sealed classes? Java answ…


Unit-Testing Databases

This past summer I was developing a basic ASP.NET/SQL Server CRUD app, and unit testing was one of the requirements. I ran into some trouble when I tried to test against the database. To my underst…



What's the best mock framework for Java?

What's the best framework for creating mock objects in Java? Why? What are the pros and cons of each framework?…


visual studio 2008 - How to Ease TDD with MSTest/VS2008

I've read time and time again that TDD/test first is more difficult with MSTest than it is with other testing frameworks such as nUnit, MBUnit, etc... What are some suggested manual workarounds and/o…


How to unit test an object with database queries

I've heard that unit testing is "totally awesome", "really cool" and "all manner of good things" but 70% or more of my files involve database access(some read and some write) and I'm not sure how to…


asp.net mvc - Mocking Asp.net-mvc Controller Context

So the controller context depends on some asp.net internals. What are some ways to cleanly mock these up for unit tests? Seems like its very easy to clog up tests with tons of setup when I only need,…


Checking the results of a Factory in a unit test

I have developed some classes with similar behavior, they all implement the same interface. I implemented a factory that creates the appropriate object and returns the interface. I am writing a uni…


How do I unit test a WCF service?

We have a whole bunch of DLLs that give us access to our database and other applications and services. We've wrapped these DLLs with a thin WCF service layer which our clients then consume. I'm a lit…




test method unit testing how example with mockito class moq