Test asynchronous queries rhino mocks RRS feed

  • Question

  • Following is my function

     public async Task<IEnumerable<Books>> GetAsync(Guid customerId) {
            var BookList= await _bookStore.FindBy(AnExpression(customerId)).ToListAsync();
            return vehicleList;

    I tried to mock the _bookStore.FindBy() Method which returns IQueryable

     var Books= new List<Books>(2){
                    new Books(),
                    new Books()
     mock.Expect(viewStore => viewStore.FindBy(Arg<Expression<Func<Books, bool>>>.Is.Anything)).Return(Books);

    I am getting following error

    System.InvalidOperationException: The source IQueryable doesn't implement IDbAsyncEnumerable. Only sources that implement IDbAsyncEnumerable can be used for Entity Framework asynchronous operations

    I tried implementing AsyncQueryProvider like

    But the implementation is shown with Moq not with Rhino mock.


    Wednesday, September 9, 2015 8:42 AM


All replies