Mocking out nHibernate QueryOver with Moq

前端 未结 5 2035
终归单人心
终归单人心 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:18

    Don't try to mock QueryOver. Instead, define a repository interface (which uses QueryOver internally) and mock that interface.

提交回复
热议问题