Telerik JustMock
Language-integrated queries, also known as LINQ, are a set of technologies based on integrating query capabilities directly into the C# & VB languages. They are very popular and widely used thanks to offering a common syntax for querying any type of data source, decreasing development time by catching errors at compile-time, etc.
[TestMethod]
public
void
ShouldAssertWithCustomSelect()
{
var simpleDataInstance =
new
SimpleData();
// ARRANGE - When simpleDataInstance.Products_GET is called,
// it should return expected collection.
Mock.Arrange(() => simpleDataInstance.Products)
.ReturnsCollection(ReturnExpextedCollectionOfProducts());
// ACT - Applying a LINQ query for simpleDataMock.Products.
var actual = (from p
in
simpleDataInstance.Products
where p.UnitsInStock == 50
select p.ProductID).SingleOrDefault();
// ASSERT
Assert.AreEqual(2, actual);
}