public async void GetFirstOrDefaultDataEntity_WithNoResults_ReturnsNull() { var dataSourceMock = new Mock <IDataSource <TestModel> >(); dataSourceMock.Setup(m => m.GetIQueryable()).ReturnsAsync( new List <TestModel>() { new TestModel() { id = 2, order = 1 }, new TestModel() { id = 3, order = 2 }, new TestModel() { id = 10, order = 3 } }.AsQueryable()); IQueryRepository <TestModel> queryRepository = new QueryRepository <TestModel>(dataSourceMock.Object); var result = await queryRepository.GetFirstOrDefaultDataEntity(new TestSpecification(9)); Assert.Null(result); }