Пример #1
0
 public void DeleteUserTest()
 {
     using (DBUser dbUser = new DBUser())
     {
         User user = new User();
         dbUser.Connection = new MySqlConnection(connString);
         dbUser.Connection.Open();
         user.Name = "TestDelete";
         user.Password = "******";
         user.Group = 1;
         Assert.IsTrue(dbUser.Save(user));
         int lastID = (int)dbUser.LastID;
         dbUser.Load(lastID);
         Assert.IsNotNull(dbUser.BusinessObject);
         dbUser.Delete();
         dbUser.Load(lastID);
         Assert.IsNull(dbUser.BusinessObject);
         Assert.IsTrue(dbUser.Save(user));
         lastID = (int)dbUser.LastID;
         dbUser.Delete(lastID);
         dbUser.Load(lastID);
         Assert.IsNull(dbUser.BusinessObject);
     }
 }