public void DeleteEntityTest() { UserRole role = new UserRole() { CNName = "Admin", ENName = "普通管理员" }; UserInfo user = new UserInfo() { UserName = "******", Password = "******", Roles = new List <UserRole>() { role } }; userDal.AddEntity(user); session.SaveChanges(); Assert.IsTrue(userDal.DeleteEntity(user)); Assert.IsTrue(session.SaveChanges() > 0); session.DisposeDBContext(); }