public void TestSaveMethod() { Person marge = new Person("marge", "simpson", "234567890", "*****@*****.**", Gender.FEMALE); Assert.IsTrue(persMgr.SavePerson(marge)); // Cleanup persMgr.DeletePerson(marge.FirstName, marge.LastName); }
private void Delete() { try { // Store name to call the actual delete method string firstName = _displayEmployee.FirstName; string lastName = _displayEmployee.LastName; // Update the screen to make it blank _displayEmployee = new Employee(); base.OnPropertyChanged("FirstName"); base.OnPropertyChanged("LastName"); base.OnPropertyChanged("PhoneNumber"); base.OnPropertyChanged("Email"); base.OnPropertyChanged("GenderType"); base.OnPropertyChanged("Street"); base.OnPropertyChanged("City"); base.OnPropertyChanged("State"); base.OnPropertyChanged("ZipCode"); base.OnPropertyChanged("RankType"); base.OnPropertyChanged("EmployeesJobs"); AddFamilyPerson = new Person(); SelectedJobOption = new Job(); // Delete the employee, update employees collection, and fire change event if (_persMgr.DeletePerson(firstName, lastName)) { _employees = new CollectionView(_persMgr.GetEmployees()); base.OnPropertyChanged("Employees"); _familyOptions = new CollectionView(_persMgr.GetPeople()); base.OnPropertyChanged("FamilyOptions"); _jobOptions = new CollectionView(_jobMgr.GetAllJobs()); base.OnPropertyChanged("JobOptions"); // Success _labelMessage = String.Format("Deleted {0} {1}", firstName, lastName); base.OnPropertyChanged("LabelMessage"); } else { // Error _labelMessage = String.Format("Unable to Delete {0} {1}", firstName, lastName); base.OnPropertyChanged("LabelMessage"); } } catch (Exception e) { _labelMessage = String.Format("Error in Delete Message"); base.OnPropertyChanged("LabelMessage"); } }