c# - How to unit test the saving of a collection -
i trying write unit test method saves multiple records database. method passed collection argument. method loops through collection. userid associated object set , record updated in the database. done every object in collection. idea on how create unit test besides having write database.
thanks,
as mentioned in comments, have option abstract database operations interface. if use orm, can implement generic repositories, if use plain ado.net, can implement transaction script.
another option use sqlite in-memory database. not clear db interface using, sqlite supported majority of database access methods in .net, including entity framework. not unit test job.
Comments
Post a Comment