O'Reilly logo

Professional Test-Driven Development with C#: Developing Real World Applications with TDD by Jeff McWherter, James Bender

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

A BRIEF LOOK AT MOQ

.NET has many mocking frameworks. For years Rhino Mocks was the mocking framework for .NET, and many applications used it extensively in test suites. In addition to Rhino Mocks, other mocking frameworks such as NUnit Mocks, TypeMock, and Easy Mock have gained popularity. They are all good frameworks and offer various features that may make them more or less appealing to various developers and development teams. Some developers still prefer to hand-roll their own mocks, but this is becoming less frequent as mocking frameworks have become more widespread, full-featured, and easy to use. A mocking framework is definitely preferable to rolling your own mocks, and it can make your TDD experience more efficient and fulfilling. Moq is quickly becoming one of the most popular mocking frameworks for .NET. It has a solid list of features, is easy to use, and has a large community support base, which ensures constant improvement and development of Moq's features.

What Does a Mocking Framework Do?

A mocking framework gives you the facilities to quickly create and consume stubs and mocks. Using a mocking frameworks API, you can create your mocks and inject your own testing functionality at runtime. Mocking frameworks also give you a Domain-Specific Language (DSL) for defining execution rules for your mocked resources.

A Bit About Moq

Moq is an open-source .NET mocking framework that is published under the BSD license. Moq was built to take advantage of new language features ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required