I am doing DAO unit tests in my project and I have a problem using the class ObjectSet. I need to create a new one ObjectSet, but for this I should not connect to the database. Therefore, I cannot use the method BusinessModelContainer CreateObjectSet(). Is there any way to create ObjectSetwithout it?
The unit test code is as follows:
var mock = new Mock<IBusinessModelContainerWrapper>();
ObjectSet<Student> expectedStudent = ???;
StudentDao studentDao = new StudentDao(mock.Object);
expectedStudent.Add(someObj);
mock.Setup(c => c.Students).Returns(expectedStudent);
Assert.AreEqual(someObj, studentDao.GetByQuery(...));
source
share