void GetToDeleteEmployeeDetail(Employee employeeToDelete) { string fullName = employeeToDelete.FirstName + "." + employeeToDelete.LastName; Console.WriteLine(ResourceCulture.GetString("DeleteWarning1") + " " + fullName + ResourceCulture.GetString("DeleteWarning2")); ConsoleKey inputCommand = Console.ReadKey().Key; if (inputCommand == ConsoleKey.D) { EmployeeEntity employeeEntity = new EmployeeEntity(); bool result = employeeEntity.DeleteEmployee(employeeToDelete.EmployeeId); if (result) { Console.WriteLine("\n\n" + ResourceCulture.GetString("DeleteSuccessInfo") + "\n"); } else { Console.WriteLine("\n\n" + ResourceCulture.GetString("DeleteFailInfo") + "\n"); } } else if ((inputCommand == ConsoleKey.Escape)) { EmployeePage employeePage = new EmployeePage(); employeePage.DisplayMainPage(); employeePage.OperateMainPage(); } else { return; } }
public void DeleteEmployee_withNonExistentId() { EmployeeEntity employeeEntity = new EmployeeEntity(); int employeeId = 199; EmployeeDataEntity employeeDataEntity = new EmployeeDataEntity(); bool result = employeeEntity.DeleteEmployee(employeeId); EmployeeDataEntity.EmployeeBase.Clear(); Assert.IsFalse(result); }