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

Advertisements

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