LINQ to mocks

Language-Integrated Query (LINQ) is a language construct introduced in .NET 4.0, which provides query capabilities in the .NET Framework. LINQ has query expressions that are written in a declarative query syntax. There are different implementations of LINQ-LINQ to XML, used for querying XML documents, LINQ to entities, which is used for ADO.NET Entity Framework operations, LINQ to objects used for querying .NET collections, files, strings, and so on.

Throughout this chapter, we have created mock objects using Lambda expressions syntax. Another exciting feature available in the Moq framework is LINQ to mocks, which allows you to set up mocks using LINQ like syntax.

LINQ to Mocks is great for simple mocks, and for stubbing out ...

Get C# and .NET Core Test Driven Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.