Mocking out nHibernate QueryOver with Moq

前端 未结 5 2031
终归单人心
终归单人心 2021-01-04 20:41

The following line fails with a null reference, when testing:

var awards = _session.QueryOver().Where(x => x.BusinessId == (int)business).List         


        
5条回答
  •  感动是毒
    2021-01-04 21:19

    I don't think the above code is right. AFAIK QueryOver is an extension method on ISession interface and you can not Mock extensions method like that (at least not with conventional Mocking tools like Moq or RhinoMocks).

提交回复
热议问题