c# - Managing complex unit test mock data -
i make unit tests code relies on rather complex database structure (nested, circular references etc.). this:
var personrepository = new mock<ipersonrepository>(); personrepository.setup(r => r.getperson()).returns( new person() { firstname = "joe", lastname = "smith" });
the problem "complex" data feel tests gets cluttered mock data. options? thought saving data .json files, guess work. ideally, use in memory representation of database snapshot. possible using ef6? other suggestions?
you might want @ effort, designed allow unit test code uses entity framework.
it @ database , construct in-memory version acts real thing, can recreated each test. write code populate pseudo database data, allowing test it.
Comments
Post a Comment