public void TestContactContact() { //Arrange var testGetContacts = GetAllContacts(); UserInfoController mvcContr = new UserInfoController(); //Act ActionResult result = mvcContr.Delete(1); //Assert Assert.IsNotNull(result); Assert.IsInstanceOfType(result, typeof(System.Web.Mvc.RedirectToRouteResult)); }
private void btnDelete_Click(object sender, RoutedEventArgs e) { string loginName = (string)(((DataRowView)dgUsers.CurrentItem)["LoginName"]); if (loginName == SessionInfo.LoginName) { MessageBox.Show("无法删除正在登陆的用户,请退出后再删除", "系统提示"); return; } MessageBoxResult msResult = MessageBox.Show("确认要删除用户吗?", "系统提示", MessageBoxButton.YesNo); if (msResult == MessageBoxResult.Yes) { string message; Guid userID = (Guid)(((DataRowView)dgUsers.CurrentItem)["UserID"]); userInfoController.Delete(userID, out message); LogInfoController.AddLogInfo(LogInfoLevelEnum.Operate, "删除用户 " + message, SessionInfo.LoginName, this.GetType().Name, SessionInfo.ExperimentID); MessageBox.Show(message, "系统提示"); BindUserInfo(); } }