C# 如何铸造收藏<;x>;到一个易货店<;x>;

C# 如何铸造收藏<;x>;到一个易货店<;x>;,c#,linq,collections,C#,Linq,Collections,我试图建立一个最低起订量,但我需要创建一个假iquiryable。我做了一个收集,但我不知道如何把它丢给一个IQueryable Collection<DetailDataEntity> DetailDataEntityCollection = new Collection<DetailDataEntity>(); DetailDataEntity DetailDataEntity = new DetailDataEntity(); DetailDataEnt

我试图建立一个最低起订量,但我需要创建一个假iquiryable。我做了一个收集,但我不知道如何把它丢给一个IQueryable

Collection<DetailDataEntity> DetailDataEntityCollection = 
    new Collection<DetailDataEntity>();

DetailDataEntity DetailDataEntity = new DetailDataEntity();
DetailDataEntity.FeedTypeID = 1;
DetailDataEntityCollection.Add(DetailDataEntity);


_mockRepository.Setup(x => x.GetDetail(It.IsAny<Int32>(),
                                       It.IsAny<Enum.FeedTypeEnum.FeedType>())) 
               .Returns(DetailDataEntityCollection);
Collection DetailDataEntityCollection=
新收藏();
DetailDataEntity DetailDataEntity=新的DetailDataEntity();
DetailDataEntity.FeedTypeID=1;
DetailDataEntityCollection.Add(DetailDataEntity);
_mockRepository.Setup(x=>x.GetDetail(It.IsAny()),
It.IsAny())
.返回(DetailDataEntityCollection);

只要给你的收藏打电话
AsQueryable

_mockRepository.Setup(x => x.GetDetail(It.IsAny<Int32>(), 
                                       It.IsAny<Enum.FeedTypeEnum.FeedType>()))
               .Returns(DetailDataEntityCollection.AsQueryable());
\u mockRepository.Setup(x=>x.GetDetail(It.IsAny()),
It.IsAny())
.Returns(DetailDataEntityCollection.AsQueryable());

我有一个简单的ICollection对象,发现它适合我:

var tapSettings = xfmrTapSettings.ToList().AsQueryable();
我不得不在AsQueryable面前使用ToList来让它工作