I am making DAO unit tests in my project and I have a problem using the ObjectSet
class. I have to create a new ObjectSet
but in order to do this, I must not connect to the DB. So I can not use the BusinessModelContainer
's CreateObjectSet()
method. Is there is a way to create the ObjectSet
without it?
The unit test code is like this:
var mock = new Mock<IBusinessModelContainerWrapper>();
ObjectSet<Student> expectedStudent = ???; // how can I get an instance here?
StudentDao studentDao = new StudentDao(mock.Object);
expectedStudent.Add(someObj);
mock.Setup(c => c.Students).Returns(expectedStudent);
Assert.AreEqual(someObj, studentDao.GetByQuery(...));