Moq with Linq Query Expression
Before
After
Yes, it’s gonna be largely a matter of personal style and preference, just like many prefer invoking
.Where(…)and.Select(…)instead offrom…where…select.
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.
Introduction to the simplest Mock Framework for .NET – Moq
-
Screencasts – Introduction to Mocking with Moq
-
Basic Mocking with Moq
Methods
Matching Arguments
Properties
Callbacks
Verification
Also…
API (lots of examples) - API documentation
Stephen Walter - TDD : Introduction to Moq
