mardi 10 mai 2016

How to fake EntityFramework.Extended FutureQuery?

I'm looking to setup a fake repository.

public class FooRepo {

    public FutureFoo<Foo> GetById(int id) {

        var foo = new Foo();
        return new FutureValue(foo);
    }

    public FutureQuery<Foo> GetByCategory(int categoryId) {

        var foos = new[] { new Foo(), new Foo() new Foo() };

        return  //what goes here?
    }

}

The purpose of this is for writing data dependent tests while not depending on any database connectivity. This was really straightforward for the FutureValue<> type as it provides a constructor that accepts a direct object. However the constructor for FutureQuery<> takes the arguments IQueryable query, Action loadAction

Can i just ignore loadAction?

Such as: new FutureQuery<Foo>(foos.AsQueryable(), () => { });

Or what is the proper way to go about this?

Aucun commentaire:

Enregistrer un commentaire