private void btnModfiy_Click(object sender, EventArgs e) { IManagerUserStorage managerUserStorage = new ManagerUserStorage(); ManagerUser managerUser = new ManagerUser(); if (textUserName.Text.Trim() == "" || textUserPassword.Text.Trim() == "" || cmbUserSort.Text == "") { MessageBox.Show("请双击选择需要修改的记录!"); } else { managerUser.UserName = textUserName.Text; managerUser.UserPassword = textUserPassword.Text; managerUser.UserSort = cmbUserSort.Text; managerUser.UserID = Convert.ToInt32(dgvManagerUser[0, dgvManagerUser.CurrentCell.RowIndex].Value.ToString()); managerUserStorage.UpdateManagerUser(managerUser); MessageBox.Show("更新成功!"); textUserName.Text = ""; textUserPassword.Text = ""; cmbUserSort.Text = ""; } }
public void ManagerUserUpdateSuccessThree() { IManagerUserStorage managerUserStorage = new ManagerUserStorage(); ManagerUser myManagerUser = CreateManagerUserForTest( "用户5", "123456", "系统管理员"); ManagerUser createdManagerUser = managerUserStorage.CreateManagerUser(myManagerUser); Assert.AreNotEqual( 0, createdManagerUser.UserID, string.Format("Could not create ManagerUser:{0}", createdManagerUser.UserID)); myManagerUser.UserSort = "系统操作员"; managerUserStorage.UpdateManagerUser(myManagerUser); ManagerUser updatedManagerUser = managerUserStorage.ReadManagerUser( createdManagerUser.UserID); AssertManagerUserItemEqual(myManagerUser, updatedManagerUser); }
public void ManagerUserUpdateFailureUserIdArgumentException() { IManagerUserStorage managerUserStorage = new ManagerUserStorage(); ManagerUser myManagerUser = CreateManagerUserForTest( "用户6", "123456", "系统管理员"); managerUserStorage.CreateManagerUser(myManagerUser); myManagerUser.UserID = int.MaxValue; managerUserStorage.UpdateManagerUser(myManagerUser); }
public void ManagerUserUpdateFailureUserPasswordArgumentNullException() { IManagerUserStorage managerUserStorage = new ManagerUserStorage(); ManagerUser myManagerUser = CreateManagerUserForTest( "用户6", "123456", "系统管理员"); managerUserStorage.CreateManagerUser(myManagerUser); myManagerUser.UserPassword = null; managerUserStorage.UpdateManagerUser(myManagerUser); }
public void ManagerUserUpdateFailureManagerUserArgumentNullException() { IManagerUserStorage managerUserStorage = new ManagerUserStorage(); managerUserStorage.UpdateManagerUser(null); }