How to moq linq expression using xrm test framework

May 29, 2015 at 7:14 AM
Hi all,

I am unable to moq the linq expression written in my custom workflow activity. Below is the snippet of linq expression that I am trying to moq.

In this linq expression SvcContext.new_srtSet get initialised but new_srtSet doesnot contain any moq values.

Can you please help me on how to moq values in SvcContext.new_srtSet?

IList<SrtModel> allMySalesReps =
(from d in SvcContext.new_srtSet
where (d.GetAttributeValue<EntityReference>("new_Account") == Acnt)
select new SrtModel
{
Name = d.new_name,
AccountId = (Guid)d.new_Account.Id,
TargetSOWRevenue = (decimal)d.new_TargetShareofWalletRevenue,
ActualSOWRevenue = (decimal)d.new_ActualShareofWalletRevenue,
PotentialUnits = (int)d.new_PotentialUnits,
ActualSalesUnits = (int)d.new_ActualSalesUnits
}).ToList<SrtModel>();