Posted By

kirstencris on 04/05/13


mock c# moles IVF

Versions (?)

Who likes this?

1 person have marked this snippet as a favorite


How to mock an inline table valued function in LINQ to SQL

 / Published in: C#


This example is for an inline table value function with one string parameter t1 is of type YourDataContext and t2 is of type string(hence the name of the mole method)

  1. MYourDataContext.AllInstances.YourInlineTableValuedFunctionString = (t1,t2) =>
  2. {
  3. var resultsList = new List<YourInlineTableValuedFunctionResult>
  4. {
  5. new YourInlineTableValuedFunctionResult(),
  6. new YourInlineTableValuedFunctionResult()
  7. };
  8. return resultsList.AsQueryable();
  9. }

Report this snippet  

You need to login to post a comment.