c# - How can I create an instance of an ObjectSet? -


i making dao unit tests in project , have problem using objectset class. have create new objectset in order this, must not connect db. can not use businessmodelcontainer's createobjectset() method. there way create objectset without it?

the unit test code this:

var mock = new mock<ibusinessmodelcontainerwrapper>();   objectset<student> expectedstudent = ???;  // how can instance here? studentdao studentdao = new studentdao(mock.object);    expectedstudent.add(someobj);   mock.setup(c => c.students).returns(expectedstudent);    assert.areequal(someobj, studentdao.getbyquery(...));   

what testing? should not need instance of real objectset in unit test unless unit testing ef code. use mock of iobjectset instead. there no way instance of objectset without context.


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -