How many of you create your own mocks? I've recently been using Mocq and I give it the thumbs up :-)
Note it's using .net 3.5; time for an upgrade? I can't stress enough how much I love linq, today worked on a problem for a client that were using 3.0; it's a true saying " you never miss the water till the well runs dry" !
I wonder however I ever lived without it.
Moq (pronounced "Mock-you" or just "Mock") is the only mocking library for .NET developed from scratch to take full advantage of .NET 3.5 (i.e. Linq expression trees) and C# 3.0 features (i.e. lambda expressions) that make it the most productive, type-safe and refactoring-friendly mocking library available. And it supports mocking interfaces as well as classes. Its API is extremely simple and straightforward, and doesn't require any prior knowledge or experience with mocking concepts.
var mock = new Mock<ILoveThisFramework>();
// WOW! No record/replay weirdness?! :)
mock.Setup(framework => framework.DownloadExists("22.214.171.124"))
// Hand mock.Object as a collaborator and exercise it,
// like calling methods on it...
ILoveThisFramework lovable = mock.Object;
bool download = lovable.DownloadExists("126.96.36.199");
// Verify that the given method was indeed called with the expected value
mock.Verify(framework => framework.DownloadExists("188.8.131.52"));
Learn about the future of Silverlight from Corporate Vice President, Scott Guthrie and other experts, direct from Microsoft’s HQ.
If you are a INETA User Group Leader or INETA Country Lead er, please help us to deliver this message and spread it. Thanks!