Linq to Mock: Moq is born
[Updated for Moq v4] Regardless of whether you use a mocking framework/library or not, as long as you’re doing unit testing, you’re almost for sure using mocks. Most of the time they are manual mocks...
View ArticleMocks, Stubs and Fakes: it’s a continuum
Highly recommended reading: Fowler’s article Mocks aren’t Stubs. Generically called (by Gerard Meszaros’s xUnit patterns book) Test Doubles, all three kinds of test aids are intended to replace real...
View ArticleWhat’s wrong with the Record/Reply/Verify model for mocking frameworks
Most mocking frameworks, and especially the two most popular ones, Rhino Mocks and TypeMock, use a record/reply/verify model where the developer invokes members on the mock during the record phase,...
View ArticleMocks: by-the-book vs practical
Lately, there’s been some formalization of the definitions of mocks, stubs, fakes and dummies, which Fowler popularized through his site with his article Mocks aren’t Stubs by introducing the concepts...
View ArticleWhy do we need yet another NET mocking framework
[Updated for Moq v4 syntax] I got this question a couple times in the past MIX08 at Las Vegas. And this is a very valid question indeed, given that there’s already Rhino, EasyMock, TypeMock and NMock...
View ArticleLinq to Mocks is finally born
Last time I announced Linq to Mocks, some said Moq didn’t actually have anything to do with Linq. Despite the heavy usage of lambda expressions and expression trees, the "q" in Linq is for "query"...
View ArticleHow to mock a dynamic object
Someone asked me how to mock a dynamic object with Moq, which might be non-obvious. Given the following interface definition: public interface IProject { string Name { get; } dynamic Data { get; } }...
View Article