I'm working on a generic repository and I would like to test it using a NUnit.Mocks . According to Mike Hadlow in his article you can do it using Rhino mocks like this:
User[] users = new User[] { };
...
Expect.Call(userRepository.GetAll()).Return(users);
So I thought maybe I could write the same thing in NUnit.Mocks like this :
dataProviderMock = new DynamicMock(typeof(IDataProvider<User>));
var user = new User {Username = "username", Password = "password"};
var users =new[]{ user };
dataProviderMock.ExpectAndReturn("GetAll",users);
but I'm getting an InvalidCastException as I expected since there's no way to cast an array of users to an IQueryable. So here's the question how can I mock an IQueryable using NUnit.Mocks?