标签: mocking entity-framework-6 moq vs-unit-testing-framework
要更新记录,我使用方法Attach(),如
var entity = new Movie() { ID = 1}; var dbEntity = DbContext.Movies.Attach(entity); dbEntity.Genre = "rrrrrrrrrrrrrrrrrrrrrr"; DbContext.SaveChanges();
如何为上述功能编写单元测试?感谢。