Vincent Leung .NET Tech Clips

The latest tech clips from the .NET community

Moq with Linq Query Expression

 

 Before

 

image

After

image

Yes, it’s gonna be largely a matter of personal style and preference, just like many prefer invoking .Where(…) and .Select(…) instead of from…where…select.

Via Daniel Cazzulino’s Blog : Linq to Mocks is finally born

August 14, 2009 Posted by | ASP.NET, LINQ, Mock, TDD | Leave a Comment

Beginning Mocking With Moq 3

 

At this point many developers are now doing automated testing, but not necessarily unit testing. The reason I say this is that most developers don’t know how to break their applications down so that the pieces can be tested independently. Mocking is an easy way to replace dependencies during testing so that you don’t need to actually call out to a database, web service, file system, or even just another class. The idea is that you are isolating small pieces of functionality during testing, hence why they call it “unit” testing.

Part 1

Part 2

Part 3

Part 4

March 10, 2009 Posted by | Mock | Leave a Comment

Introduction to the simplest Mock Framework for .NET – Moq

Methods

image 

Matching Arguments

image 

Properties

image 

Callbacks

image

Verification

image 

Also…

API (lots of examples) - API documentation
Stephen Walter - TDD : Introduction to Moq
 

February 11, 2009 Posted by | Mock | Leave a Comment

   

Follow

Get every new post delivered to your Inbox.