Could we get some usage examples for using `CreateDBQueryMock`
1RedOne opened this issue · comments
Stephen Owen commented
Hi!
I am interested in this project as a way of mocking calls to a SQL View I expose as a QueryType in my project. But I can't figure out the syntax I should be using to call CreateDbQueryMock
Given this class:
public class MyClass {
public int MyClassID {get; set;}
public string MyClassString {get; set;}
public string MyClassColor {get; set;}
}
It seems like I should be able to mock this like so:
DbContextMock<MyContext> _myContext = new DbContextMock<MyContext>();
var members = new[] {
new MyClass (){
MyClassID =1 , MyClassString = "SomeUser", MyClassColor = "Blue"
},
new MyClass (){
MyClassID =2 , MyClassString = "SomeOtherUser", MyClassColor = "Red"
}
};
_myContext .CreateDbQueryMock<MyClass>(x=>x.MyClass, members);
But I get errors like this:
MyContext does not contain a definition for 'MyClass' and no extension method 'MyClass' acception a first argument type of 'MyContext' could be found.
Any tips?
huysentruitw commented
You've sent me a pull-request, does that mean that your question has been resolved?
Stephen Owen commented
yes, thanks.