none
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()
                }.AsQueryable();
    
     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 https://msdn.microsoft.com/en-us/data/dn314429#async

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


    markand

    Wednesday, September 9, 2015 8:42 AM

Answers

All replies